From 766da540c8859cc0983b73726dab3ce743109c16 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 3 Dec 2020 13:51:36 -0800 Subject: [PATCH 07/11] breadcrumbs: deal with incorrect height of title bar I can see that the Kirigami developers have made changes here, but this still doesn't work without that invisible element. This also hardcodes our background color for the title bar as that theming always goes wrong. Signed-off-by: Dirk Hohndel --- .../globaltoolbar/PageRowGlobalToolBarUI.qml | 18 +++++++++++++++--- src/controls/templates/private/BackButton.qml | 1 + .../templates/private/ForwardButton.qml | 1 + 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/controls/private/globaltoolbar/PageRowGlobalToolBarUI.qml b/src/controls/private/globaltoolbar/PageRowGlobalToolBarUI.qml index 4404faae..e0b26e88 100644 --- a/src/controls/private/globaltoolbar/PageRowGlobalToolBarUI.qml +++ b/src/controls/private/globaltoolbar/PageRowGlobalToolBarUI.qml @@ -28,6 +28,7 @@ Kirigami.AbstractApplicationHeader { preferredHeight: globalToolBar.preferredHeight maximumHeight: globalToolBar.maximumHeight separatorVisible: globalToolBar.separatorVisible + background: Rectangle { color: subsurfaceTheme.primaryColor } Kirigami.Theme.textColor: currentItem ? currentItem.Kirigami.Theme.textColor : parent.Kirigami.Theme.textColor @@ -35,6 +36,14 @@ Kirigami.AbstractApplicationHeader { anchors.fill: parent spacing: 0 + // I can't make the layout work without this invisible rectangle to anchor things on + Rectangle { + id: correct + height: parent.height + width: 0 + color: "transparent" + } + Item { id: leftHandleAnchor visible: (typeof applicationWindow() !== "undefined" && applicationWindow().globalDrawer && applicationWindow().globalDrawer.enabled && applicationWindow().globalDrawer.handleVisible && @@ -67,6 +76,7 @@ Kirigami.AbstractApplicationHeader { Layout.fillHeight: true Layout.leftMargin: leftHandleAnchor.visible ? Kirigami.Units.smallSpacing : 0 + Layout.alignment: Qt.AlignTop | Qt.AlignVCenter visible: (globalToolBar.showNavigationButtons != Kirigami.ApplicationHeaderStyle.NoNavigationButtons || root.layers.depth > 0) && (globalToolBar.actualStyle != Kirigami.ApplicationHeaderStyle.None) @@ -76,16 +86,18 @@ Kirigami.AbstractApplicationHeader { id: backButton Layout.leftMargin: leftHandleAnchor.visible ? 0 : Kirigami.Units.smallSpacing Layout.preferredWidth: height - Layout.maximumHeight: buttonsLayout.height + Layout.topMargin: 0 + Layout.maximumHeight: correct.height } TemplatesPrivate.ForwardButton { - Layout.maximumHeight: buttonsLayout.height + Layout.maximumHeight: correct.height Layout.preferredWidth: height } } QQC2.ToolSeparator { visible: (menuButton.visible || (buttonsLayout.visible && buttonsLayout.visibleChildren.length > 0)) && breadcrumbVisible && pageRow.depth > 1 + Layout.maximumHeight: correct.height } Loader { @@ -124,6 +136,6 @@ Kirigami.AbstractApplicationHeader { Layout.preferredWidth: height } } - background.opacity: breadcrumbLoader.opacity + //background.opacity: breadcrumbLoader.opacity } diff --git a/src/controls/templates/private/BackButton.qml b/src/controls/templates/private/BackButton.qml index 85a46d15..d1076080 100644 --- a/src/controls/templates/private/BackButton.qml +++ b/src/controls/templates/private/BackButton.qml @@ -14,6 +14,7 @@ Controls.ToolButton { id: button icon.name: (LayoutMirroring.enabled ? "go-previous-symbolic-rtl" : "go-previous-symbolic") + icon.source: (LayoutMirroring.enabled ? "go-previous-symbolic-rtl" : "go-previous-symbolic") enabled: applicationWindow().pageStack.layers.depth > 1 || (applicationWindow().pageStack.depth > 1 && (applicationWindow().pageStack.currentIndex > 0 || applicationWindow().pageStack.contentItem.contentX > 0)) diff --git a/src/controls/templates/private/ForwardButton.qml b/src/controls/templates/private/ForwardButton.qml index c756e030..68a3901b 100644 --- a/src/controls/templates/private/ForwardButton.qml +++ b/src/controls/templates/private/ForwardButton.qml @@ -14,6 +14,7 @@ Controls.ToolButton { id: button icon.name: (LayoutMirroring.enabled ? "go-next-symbolic-rtl" : "go-next-symbolic") + icon.source: (LayoutMirroring.enabled ? "go-next-symbolic-rtl" : "go-next-symbolic") enabled: applicationWindow().pageStack.currentIndex < applicationWindow().pageStack.depth-1 -- 2.25.1