Kirigami2

PageRowGlobalToolBarStyleGroup.qml
1 /*
2  * SPDX-FileCopyrightText: 2018 Marco Martin <[email protected]>
3  *
4  * SPDX-License-Identifier: LGPL-2.0-or-later
5  */
6 
7 import QtQuick 2.15
8 import org.kde.kirigami 2.19 as Kirigami
9 
10 QtObject {
11  id: globalToolBar
12  property int style: Kirigami.ApplicationHeaderStyle.None
13  onStyleChanged: if (style === Kirigami.ApplicationHeaderStyle.TabBar) {
14  console.warn("TabBar header style is deprecated.")
15  }
16  readonly property int actualStyle: {
17  if (style === Kirigami.ApplicationHeaderStyle.Auto) {
18  // TODO KF6
19  // Legacy: if ApplicationHeader or ToolbarApplicationHeader are in the header or footer, disable the toolbar here
20  if (typeof applicationWindow !== "undefined" && applicationWindow().header && applicationWindow().header.toString().indexOf("ApplicationHeader") !== -1) {
21  return Kirigami.ApplicationHeaderStyle.None
22  }
23 
24  //non legacy logic
25  return (Kirigami.Settings.isMobile
26  ? (root.wideMode ? Kirigami.ApplicationHeaderStyle.Titles : Kirigami.ApplicationHeaderStyle.Breadcrumb)
27  : Kirigami.ApplicationHeaderStyle.ToolBar)
28  }
29  return style;
30  }
31 
32  // TODO KF6: remove bool support.
33  // Until then, `true` is considered as both `ShowBackButton | ShowForwardButton` together.
34  property var/*flags<NavigationButtons> | bool*/ showNavigationButtons: (style !== Kirigami.ApplicationHeaderStyle.TabBar && (!Kirigami.Settings.isMobile || Qt.platform.os === "ios"))
35  ? (Kirigami.ApplicationHeaderStyle.ShowBackButton | Kirigami.ApplicationHeaderStyle.ShowForwardButton)
36  : Kirigami.ApplicationHeaderStyle.NoNavigationButtons
37  property bool separatorVisible: true
38  //Unfortunately we can't access pageRow.globalToolbar.Kirigami.Theme directly in a declarative way
39  property int colorSet: Kirigami.Theme.Header
40  // whether or not the header should be
41  // "pushed" back when scrolling using the
42  // touch screen
43  property bool hideWhenTouchScrolling: false
44  /**
45  * If true, when any kind of toolbar is shown, the drawer handles will be shown inside the toolbar, if they're present
46  */
47  property bool canContainHandles: true
48  property int toolbarActionAlignment: Qt.AlignRight
49  property int toolbarActionHeightMode: Kirigami.ToolBarLayout.ConstrainIfLarger
50 
51  property int minimumHeight: 0
52  // FIXME: Figure out the exact standard size of a Toolbar
53  property int preferredHeight: (actualStyle === Kirigami.ApplicationHeaderStyle.ToolBar
54  ? Kirigami.Units.iconSizes.medium
55  : Kirigami.Units.gridUnit * 1.8) + Kirigami.Units.smallSpacing * 2
56  property int maximumHeight: preferredHeight
57 
58  // Sets the minimum leading padding for the title in a page header
59  property int titleLeftPadding: Kirigami.Units.gridUnit
60 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Feb 7 2023 04:14:23 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.