Warning, /frameworks/kirigami/src/controls/private/globaltoolbar/ToolBarPageHeader.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *  SPDX-FileCopyrightText: 2018 Marco Martin <mart@kde.org>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 import QtQuick
0008 import QtQml
0009 import QtQuick.Layouts
0010 import org.kde.kirigami as Kirigami
0011 
0012 AbstractPageHeader {
0013     id: root
0014 
0015     implicitWidth: layout.implicitWidth + Kirigami.Units.smallSpacing * 2
0016     implicitHeight: Math.max(titleLoader.implicitHeight, toolBar.implicitHeight) + Kirigami.Units.smallSpacing * 2
0017 
0018     MouseArea {
0019         anchors.fill: parent
0020         onPressed: mouse => {
0021             page.forceActiveFocus()
0022             mouse.accepted = false
0023         }
0024     }
0025 
0026     RowLayout {
0027         id: layout
0028         anchors.fill: parent
0029         anchors.rightMargin: Kirigami.Units.smallSpacing
0030         spacing: Kirigami.Units.smallSpacing
0031 
0032         Loader {
0033             id: titleLoader
0034 
0035             Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
0036             Layout.fillWidth: item?.Layout.fillWidth ?? false
0037             Layout.minimumWidth: item?.Layout.minimumWidth ?? -1
0038             Layout.preferredWidth: item?.Layout.preferredWidth ?? -1
0039             Layout.maximumWidth: item?.Layout.maximumWidth ?? -1
0040 
0041             // Don't load async to prevent jumpy behaviour on slower devices as it loads in.
0042             // If the title delegate really needs to load async, it should be its responsibility to do it itself.
0043             asynchronous: false
0044             sourceComponent: page?.titleDelegate ?? null
0045         }
0046 
0047         Kirigami.ActionToolBar {
0048             id: toolBar
0049 
0050             Layout.alignment: Qt.AlignVCenter
0051             Layout.fillWidth: true
0052             Layout.fillHeight: true
0053 
0054             visible: actions.length > 0
0055             alignment: pageRow?.globalToolBar.toolbarActionAlignment ?? Qt.AlignRight
0056             heightMode: pageRow?.globalToolBar.toolbarActionHeightMode ?? Kirigami.ToolBarLayout.ConstrainIfLarger
0057 
0058             actions: page?.actions ?? []
0059         }
0060     }
0061 }