diff --git a/src/controls/OverlayDrawer.qml b/src/controls/OverlayDrawer.qml index b6f5cf9d78a928b24c6e2ebbc0ffc1f1210d07a1..df04e3816890a6779fe00239a4e42ab6405a28dd 100644 --- a/src/controls/OverlayDrawer.qml +++ b/src/controls/OverlayDrawer.qml @@ -7,7 +7,7 @@ import QtQuick 2.1 import QtGraphicalEffects 1.0 import QtQuick.Templates 2.0 as T2 -import org.kde.kirigami 2.5 +import org.kde.kirigami 2.15 import "private" import "templates" as T @@ -43,17 +43,7 @@ T.OverlayDrawer { parent: root.handle anchors.fill: parent - DropShadow { - anchors.fill: handleGraphics - visible: !parent.parent.handleAnchor || !parent.parent.handleAnchor.visible || root.handle.pressed || (root.modal && root.position > 0) - horizontalOffset: 0 - verticalOffset: Units.devicePixelRatio - radius: Units.gridUnit /2 - samples: 16 - color: Qt.rgba(0, 0, 0, root.handle.pressed ? 0.6 : 0.4) - source: handleGraphics - } - Rectangle { + ShadowedRectangle { id: handleGraphics anchors.centerIn: parent @@ -66,7 +56,11 @@ T.OverlayDrawer { Theme.inherit: false color: root.handle.pressed ? Theme.highlightColor : Theme.backgroundColor - visible: !parent.parent.handleAnchor || !parent.parent.handleAnchor.visible + visible: !parent.parent.handleAnchor || !parent.parent.handleAnchor.visible || root.handle.pressed || (root.modal && root.position > 0) + + shadow.color: Qt.rgba(0, 0, 0, root.handle.pressed ? 0.6 : 0.4) + shadow.yOffset: 1 + shadow.size: Units.gridUnit / 2 width: Units.iconSizes.smallMedium + Units.smallSpacing * 2 height: width diff --git a/src/controls/Page.qml b/src/controls/Page.qml index 7dd90177b2e4015f46330f31a5afd733cccf66a3..105b5d828bf112d2216c154ca0ff9bea32e6f4bb 100644 --- a/src/controls/Page.qml +++ b/src/controls/Page.qml @@ -330,6 +330,7 @@ QQC2.Page { headerChanged(); parentChanged(root.parent); globalToolBar.syncSource(); + actionButtons.pageComplete = true } onParentChanged: { @@ -427,12 +428,44 @@ QQC2.Page { //It should be T2.Page, Qt 5.7 doesn't like it property Item page: root height: item ? item.implicitHeight : 0 - active: typeof applicationWindow !== "undefined" && (!globalToolBar.row || root.globalToolBarStyle !== Kirigami.ApplicationHeaderStyle.ToolBar) && - root.actions && (root.actions.main || root.actions.left || root.actions.right || root.actions.contextualActions.length) && - //Legacy - (typeof applicationWindow === "undefined" || - (!applicationWindow().header || applicationWindow().header.toString().indexOf("ToolBarApplicationHeader") === -1) && - (!applicationWindow().footer || applicationWindow().footer.toString().indexOf("ToolBarApplicationHeader") === -1)) + + property bool pageComplete: false + + active: { + // Important! Do not do anything until the page has been + // completed, so we are sure what the globalToolBarStyle is, + // otherwise we risk creating the content and then discarding it. + if (!pageComplete) { + return false; + } + + // Note: Do not use root.globalToolBarStyle here as it is + // evaluated too late and will cause active to be true for a + // brief period, triggering the loading process. + if (globalToolBar.row.globalToolBar.actualStyle === Kirigami.ApplicationHeaderStyle.ToolBar) { + return false; + } + + if (!root.actions.main && !root.actions.left && !root.actions.right && root.actions.contextualActions.length == 0) { + return false; + } + + // Legacy + if (typeof applicationWindow === "undefined") { + return true; + } + + if (applicationWindow().header && applicationWindow().header.toString().indexOf("ToolBarApplicationHeader") !== -1) { + return false; + } + + if (applicationWindow().footer && applicationWindow().footer.toString().indexOf("ToolBarApplicationHeader") !== -1) { + return false; + } + + return true; + } + source: Qt.resolvedUrl("./private/ActionButton.qml") } ]