diff --git a/src/controls/private/AbstractPageHeader.qml b/src/controls/private/AbstractPageHeader.qml index 94f34606..9c7197ee 100644 --- a/src/controls/private/AbstractPageHeader.qml +++ b/src/controls/private/AbstractPageHeader.qml @@ -1,44 +1,44 @@ /* * Copyright 2018 Marco Martin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.5 import QtQuick.Controls 2.0 as Controls import QtQuick.Layouts 1.2 import org.kde.kirigami 2.5 AbstractApplicationHeader { id: root anchors.fill: parent property Item container property bool current minimumHeight: pageRow.globalToolBar.minimumHeight maximumHeight: pageRow.globalToolBar.maximumHeight preferredHeight: pageRow.globalToolBar.preferredHeight implicitHeight: page.y leftPadding: Math.min(Qt.application.layoutDirection == Qt.LeftToRight ? Math.max(0, pageRow.ScenePosition.x - page.ScenePosition.x + pageRow.globalToolBar.leftReservedSpace) : Math.max(0, -pageRow.width + pageRow.ScenePosition.x + page.ScenePosition.x + page.width + pageRow.globalToolBar.leftReservedSpace), root.width/2) rightPadding: Qt.application.layoutDirection == Qt.LeftToRight - ? Math.min(-pageRow.width + pageRow.ScenePosition.x + page.ScenePosition.x + page.width + pageRow.globalToolBar.rightReservedSpace) + ? Math.min(-pageRow.width - pageRow.ScenePosition.x + page.ScenePosition.x + page.width + pageRow.globalToolBar.rightReservedSpace) : Math.max(0, pageRow.ScenePosition.x - page.ScenePosition.x + pageRow.globalToolBar.rightReservedSpace) } diff --git a/src/controls/private/PageRowGlobalToolBarUI.qml b/src/controls/private/PageRowGlobalToolBarUI.qml index aa21760e..8a3df2c9 100644 --- a/src/controls/private/PageRowGlobalToolBarUI.qml +++ b/src/controls/private/PageRowGlobalToolBarUI.qml @@ -1,97 +1,97 @@ /* * Copyright 2018 Marco Martin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.1 import QtQuick.Layouts 1.2 import org.kde.kirigami 2.4 as Kirigami import "../templates/private" as TemplatesPrivate Kirigami.AbstractApplicationHeader { id: header readonly property int leftReservedSpace: buttonsLayout.visible && buttonsLayout.visibleChildren.length > 1 ? buttonsLayout.width : 0 readonly property int rightReservedSpace: rightHandleAnchor.visible ? backButton.background.implicitHeight : 0 readonly property alias leftHandleAnchor: leftHandleAnchor readonly property alias rightHandleAnchor: rightHandleAnchor height: visible ? implicitHeight : 0 minimumHeight: globalToolBar.minimumHeight preferredHeight: globalToolBar.preferredHeight maximumHeight: globalToolBar.maximumHeight RowLayout { anchors.fill: parent spacing: 0 RowLayout { id: buttonsLayout visible: globalToolBar.showNavigationButtons && globalToolBar.actualStyle != Kirigami.ApplicationHeaderStyle.None Item { id: leftHandleAnchor visible: typeof applicationWindow() !== "undefined" && applicationWindow().globalDrawer.handleVisible && - (applicationWindow().globalDrawer.handle.handleAnchor == Qt.application.layoutDirection == Qt.LeftToRight ? leftHandleAnchor : rightHandleAnchor) + (applicationWindow().globalDrawer.handle.handleAnchor == (Qt.application.layoutDirection == Qt.LeftToRight ? leftHandleAnchor : rightHandleAnchor)) Layout.preferredWidth: backButton.background.implicitHeight Layout.preferredHeight: backButton.background.implicitHeight } TemplatesPrivate.BackButton { id: backButton Layout.leftMargin: leftHandleAnchor.visible ? 0 : Kirigami.Units.smallSpacing Layout.preferredWidth: background.implicitHeight Layout.preferredHeight: background.implicitHeight } TemplatesPrivate.ForwardButton { Layout.preferredWidth: background.implicitHeight Layout.preferredHeight: background.implicitHeight } Kirigami.Separator { Layout.preferredHeight: parent.parent.height * 0.6 //FIXME: hacky opacity: buttonsLayout.visibleChildren.length > 1 } } Loader { id: breadcrumbLoader Layout.fillWidth: true Layout.fillHeight: true active: globalToolBar.actualStyle == Kirigami.ApplicationHeaderStyle.TabBar || globalToolBar.actualStyle == Kirigami.ApplicationHeaderStyle.Breadcrumb //TODO: different implementation? sourceComponent: Kirigami.ApplicationHeader { minimumHeight: height preferredHeight: height maximumHeight: height backButtonEnabled: false anchors.fill:parent background.visible: false headerStyle: globalToolBar.style } } Item { id: rightHandleAnchor - visible: typeof applicationWindow() !== "undefined" && applicationWindow().contextDrawer && applicationWindow().contextDrawer.handleVisible && applicationWindow().contextDrawer.handle.handleAnchor == Qt.application.layoutDirection == Qt.LeftToRight ? rightHandleAnchor : leftHandleAnchor + visible: typeof applicationWindow() !== "undefined" && applicationWindow().contextDrawer && applicationWindow().contextDrawer.handleVisible && applicationWindow().contextDrawer.handle.handleAnchor == Qt.application.layoutDirection == (Qt.LeftToRight ? rightHandleAnchor : leftHandleAnchor) Layout.preferredWidth: backButton.background.implicitHeight Layout.preferredHeight: backButton.background.implicitHeight } } background.visible: breadcrumbLoader.active }