Warning, /frameworks/kirigami/src/controls/ToolBarApplicationHeader.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.5 0008 import QtQuick.Controls 2.0 as QQC2 0009 import QtQuick.Layouts 1.2 0010 import org.kde.kirigami 2.4 as Kirigami 0011 import "private" as P 0012 0013 0014 // TODO KF6: Remove! 0015 /** 0016 * @brief ToolBarApplicationHeader represents a toolbar that 0017 * will display the actions of the current page. 0018 * 0019 * Both Contextual actions and the main, left and right actions 0020 * 0021 * @deprecated This will be removed in KF6. 0022 */ 0023 ApplicationHeader { 0024 id: header 0025 0026 preferredHeight: 42 0027 maximumHeight: preferredHeight 0028 headerStyle: ApplicationHeaderStyle.Titles 0029 0030 // FIXME: needs a property definition to have its own type in qml 0031 /** @internal */ 0032 property string _internal: "" 0033 0034 Component.onCompleted: print("Warning: ToolbarApplicationHeader is deprecated, remove and use the automatic internal toolbar instead.") 0035 pageDelegate: Item { 0036 id: delegateItem 0037 readonly property bool current: __appWindow.pageStack.currentIndex === index 0038 implicitWidth: titleTextMetrics.width/2 + buttonTextMetrics.collapsedButtonsWidth 0039 0040 RowLayout { 0041 id: titleLayout 0042 anchors { 0043 verticalCenter: parent.verticalCenter 0044 left: parent.left 0045 right: actionsLayout.left 0046 } 0047 Kirigami.Separator { 0048 id: separator 0049 Layout.preferredHeight: parent.height * 0.6 0050 } 0051 0052 Kirigami.Heading { 0053 id: title 0054 Layout.fillWidth: true 0055 0056 Layout.preferredWidth: implicitWidth 0057 Layout.minimumWidth: Math.min(titleTextMetrics.width, delegateItem.width - buttonTextMetrics.requiredWidth) 0058 leftPadding: Kirigami.Units.largeSpacing 0059 opacity: delegateItem.current ? 1 : 0.4 0060 maximumLineCount: 1 0061 color: Kirigami.Theme.textColor 0062 elide: Text.ElideRight 0063 text: page ? page.title : "" 0064 } 0065 } 0066 0067 TextMetrics { 0068 id: titleTextMetrics 0069 text: page ? page.title : "" 0070 font: title.font 0071 } 0072 TextMetrics { 0073 id: buttonTextMetrics 0074 text: (page.actions.left ? page.actions.left.text : "") + (page.actions.main ? page.actions.main.text : "") + (page.actions.right ? page.actions.right.text : "") 0075 readonly property int collapsedButtonsWidth: ctxActionsButton.width + (page.actions.left ? ctxActionsButton.width + Kirigami.Units.gridUnit : 0) + (page.actions.main ? ctxActionsButton.width + Kirigami.Units.gridUnit : 0) + (page.actions.right ? ctxActionsButton.width + Kirigami.Units.gridUnit : 0) 0076 readonly property int requiredWidth: width + collapsedButtonsWidth 0077 } 0078 0079 RowLayout { 0080 id: actionsLayout 0081 anchors { 0082 verticalCenter: parent.verticalCenter 0083 right: ctxActionsButton.visible ? ctxActionsButton.left : parent.right 0084 } 0085 0086 readonly property bool toobig: delegateItem.width - titleTextMetrics.width - Kirigami.Units.gridUnit < buttonTextMetrics.requiredWidth 0087 0088 P.PrivateActionToolButton { 0089 Layout.alignment: Qt.AlignVCenter 0090 action: page && page.actions ? page.actions.left : null 0091 display: parent.toobig ? QQC2.AbstractButton.IconOnly : QQC2.AbstractButton.TextBesideIcon 0092 } 0093 P.PrivateActionToolButton { 0094 Layout.alignment: Qt.AlignVCenter 0095 Layout.rightMargin: Kirigami.Units.smallSpacing 0096 action: page && page.actions ? page.actions.main : null 0097 display: parent.toobig ? QQC2.AbstractButton.IconOnly : QQC2.AbstractButton.TextBesideIcon 0098 flat: false 0099 } 0100 P.PrivateActionToolButton { 0101 Layout.alignment: Qt.AlignVCenter 0102 action: page && page.actions ? page.actions.right : null 0103 display: parent.toobig ? QQC2.AbstractButton.IconOnly : QQC2.AbstractButton.TextBesideIcon 0104 } 0105 } 0106 0107 P.PrivateActionToolButton { 0108 id: ctxActionsButton 0109 showMenuArrow: page.actions.contextualActions.length === 1 0110 anchors { 0111 right: parent.right 0112 verticalCenter: parent.verticalCenter 0113 rightMargin: Kirigami.Units.smallSpacing 0114 } 0115 Kirigami.Action { 0116 id: overflowAction 0117 icon.name: "overflow-menu" 0118 tooltip: qsTr("More Actions") 0119 visible: children.length > 0 0120 children: page && page.actions.contextualActions ? page.actions.contextualActions : null 0121 } 0122 0123 action: page && page.actions.contextualActions.length === 1 ? page.actions.contextualActions[0] : overflowAction 0124 } 0125 } 0126 }