diff --git a/src/controls/GlobalDrawer.qml b/src/controls/GlobalDrawer.qml --- a/src/controls/GlobalDrawer.qml +++ b/src/controls/GlobalDrawer.qml @@ -69,7 +69,8 @@ edge: Qt.application.layoutDirection == Qt.RightToLeft ? Qt.RightEdge : Qt.LeftEdge handleClosedIcon.source: null handleOpenIcon.source: null - + handleVisible: (typeof(applicationWindow)===typeof(Function) && applicationWindow() ? applicationWindow().controlsVisible : true) && (!isMenu || Settings.isMobile) + /** * title: string * A title to be displayed on top of the drawer @@ -214,6 +215,13 @@ */ readonly property Action currentSubMenu: stackView.currentItem ? stackView.currentItem.current: null + /** + * isMenu: bool + * When true the global drawer becomes a menu on the desktop. Defauls to false. + * @since 2.11 + */ + property bool isMenu: false + /** * Notifies that the banner has been clicked */ diff --git a/src/controls/private/globaltoolbar/PageRowGlobalToolBarUI.qml b/src/controls/private/globaltoolbar/PageRowGlobalToolBarUI.qml --- a/src/controls/private/globaltoolbar/PageRowGlobalToolBarUI.qml +++ b/src/controls/private/globaltoolbar/PageRowGlobalToolBarUI.qml @@ -21,11 +21,11 @@ import QtQuick.Layouts 1.2 import org.kde.kirigami 2.4 as Kirigami import "../../templates/private" as TemplatesPrivate - +import "../" as Private Kirigami.AbstractApplicationHeader { id: header - readonly property int leftReservedSpace: (buttonsLayout.visible && buttonsLayout.visibleChildren.length > 0 ? buttonsLayout.width : 0) + (leftHandleAnchor.visible ? leftHandleAnchor.width : 0) + readonly property int leftReservedSpace: (buttonsLayout.visible && buttonsLayout.visibleChildren.length > 0 ? buttonsLayout.width : 0) + (leftHandleAnchor.visible ? leftHandleAnchor.width : 0) + (menuButton.visible ? menuButton.width : 0) readonly property int rightReservedSpace: rightHandleAnchor.visible ? backButton.background.implicitHeight : 0 readonly property alias leftHandleAnchor: leftHandleAnchor @@ -57,6 +57,21 @@ Layout.preferredWidth: height } + Private.PrivateActionToolButton { + id: menuButton + visible: !Kirigami.Settings.isMobile && applicationWindow().globalDrawer.isMenu + icon.name: "application-menu" + showMenuArrow: false + + Layout.preferredHeight: Math.min(backButton.implicitHeight, parent.height) + Layout.preferredWidth: height + Layout.leftMargin: Kirigami.Units.smallSpacing + + kirigamiAction: Kirigami.Action { + children: applicationWindow().globalDrawer.actions + } + } + RowLayout { id: buttonsLayout Layout.fillHeight: true