Kirigami2

ToolBarPageHeader.qml
1/*
2 * SPDX-FileCopyrightText: 2018 Marco Martin <mart@kde.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7import QtQuick
8import QtQml
9import QtQuick.Layouts
10import org.kde.kirigami as Kirigami
11
12AbstractPageHeader {
13 id: root
14
15 implicitWidth: layout.implicitWidth + Kirigami.Units.smallSpacing * 2
16 implicitHeight: Math.max(titleLoader.implicitHeight, toolBar.implicitHeight) + Kirigami.Units.smallSpacing * 2
17
18 MouseArea {
19 anchors.fill: parent
20 onPressed: mouse => {
21 page.forceActiveFocus()
22 mouse.accepted = false
23 }
24 }
25
26 RowLayout {
27 id: layout
28 anchors.fill: parent
29 anchors.rightMargin: Kirigami.Units.smallSpacing
30 spacing: Kirigami.Units.smallSpacing
31
32 Loader {
33 id: titleLoader
34
35 Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
36 Layout.fillWidth: item?.Layout.fillWidth ?? false
37 Layout.minimumWidth: item?.Layout.minimumWidth ?? -1
38 Layout.preferredWidth: item?.Layout.preferredWidth ?? -1
39 Layout.maximumWidth: item?.Layout.maximumWidth ?? -1
40
41 // Don't load async to prevent jumpy behaviour on slower devices as it loads in.
42 // If the title delegate really needs to load async, it should be its responsibility to do it itself.
43 asynchronous: false
44 sourceComponent: page?.titleDelegate ?? null
45 }
46
47 Kirigami.ActionToolBar {
48 id: toolBar
49
50 Layout.alignment: Qt.AlignVCenter
51 Layout.fillWidth: true
52 Layout.fillHeight: true
53
54 visible: actions.length > 0
55 alignment: pageRow?.globalToolBar.toolbarActionAlignment ?? Qt.AlignRight
56 heightMode: pageRow?.globalToolBar.toolbarActionHeightMode ?? Kirigami.ToolBarLayout.ConstrainIfLarger
57
58 actions: page?.actions ?? []
59 }
60 }
61}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 3 2024 11:49:34 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.