From fc3c8e9fdb0454e69ab79ad70eaab371782de12a Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Tue, 28 Nov 2017 20:08:21 +0200 Subject: [PATCH] fix RTL layout for vertical and alignments --- .../package/contents/ui/LayoutsContainer.qml | 16 ++++++++++++---- containment/package/contents/ui/PanelBox.qml | 16 ++++++++++++---- .../package/contents/ui/ParabolicManager.qml | 2 +- containment/package/contents/ui/main.qml | 2 +- .../package/contents/ui/ParabolicManager.qml | 2 +- plasmoid/package/contents/ui/main.qml | 2 +- .../package/contents/ui/task/TaskIconItem.qml | 2 +- 7 files changed, 29 insertions(+), 13 deletions(-) diff --git a/containment/package/contents/ui/LayoutsContainer.qml b/containment/package/contents/ui/LayoutsContainer.qml index 603610edd..4fcfbfa40 100644 --- a/containment/package/contents/ui/LayoutsContainer.qml +++ b/containment/package/contents/ui/LayoutsContainer.qml @@ -456,7 +456,9 @@ Item{ }, State { name: "bottomLeft" - when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === Latte.Dock.Left) + when: (plasmoid.location === PlasmaCore.Types.BottomEdge) + &&(((root.panelAlignment === Latte.Dock.Left)&&(Qt.application.layoutDirection !== Qt.RightToLeft)) + || ((root.panelAlignment === Latte.Dock.Right)&&(Qt.application.layoutDirection === Qt.RightToLeft))) AnchorChanges { target: _mainLayout @@ -470,7 +472,9 @@ Item{ }, State { name: "bottomRight" - when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === Latte.Dock.Right) + when: (plasmoid.location === PlasmaCore.Types.BottomEdge) + &&(((root.panelAlignment === Latte.Dock.Right)&&(Qt.application.layoutDirection !== Qt.RightToLeft)) + ||((root.panelAlignment === Latte.Dock.Left)&&(Qt.application.layoutDirection === Qt.RightToLeft))) AnchorChanges { target: _mainLayout @@ -499,7 +503,9 @@ Item{ }, State { name: "topLeft" - when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === Latte.Dock.Left) + when: (plasmoid.location === PlasmaCore.Types.TopEdge) + &&(((root.panelAlignment === Latte.Dock.Left)&&(Qt.application.layoutDirection !== Qt.RightToLeft)) + || ((root.panelAlignment === Latte.Dock.Right)&&(Qt.application.layoutDirection === Qt.RightToLeft))) AnchorChanges { target: _mainLayout @@ -513,7 +519,9 @@ Item{ }, State { name: "topRight" - when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === Latte.Dock.Right) + when: (plasmoid.location === PlasmaCore.Types.TopEdge) + &&(((root.panelAlignment === Latte.Dock.Right)&&(Qt.application.layoutDirection !== Qt.RightToLeft)) + ||((root.panelAlignment === Latte.Dock.Left)&&(Qt.application.layoutDirection === Qt.RightToLeft))) AnchorChanges { target: _mainLayout diff --git a/containment/package/contents/ui/PanelBox.qml b/containment/package/contents/ui/PanelBox.qml index b02673052..2039dccd9 100644 --- a/containment/package/contents/ui/PanelBox.qml +++ b/containment/package/contents/ui/PanelBox.qml @@ -576,7 +576,9 @@ Item{ }, State { name: "bottomLeft" - when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === Latte.Dock.Left) + when: (plasmoid.location === PlasmaCore.Types.BottomEdge) + &&(((root.panelAlignment === Latte.Dock.Left)&&(Qt.application.layoutDirection !== Qt.RightToLeft)) + || ((root.panelAlignment === Latte.Dock.Right)&&(Qt.application.layoutDirection === Qt.RightToLeft))) AnchorChanges { target: barLine @@ -595,7 +597,9 @@ Item{ }, State { name: "bottomRight" - when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === Latte.Dock.Right) + when: (plasmoid.location === PlasmaCore.Types.BottomEdge) + &&(((root.panelAlignment === Latte.Dock.Right)&&(Qt.application.layoutDirection !== Qt.RightToLeft)) + ||((root.panelAlignment === Latte.Dock.Left)&&(Qt.application.layoutDirection === Qt.RightToLeft))) AnchorChanges { target: barLine @@ -650,7 +654,9 @@ Item{ }, State { name: "topLeft" - when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === Latte.Dock.Left) + when: (plasmoid.location === PlasmaCore.Types.TopEdge) + &&(((root.panelAlignment === Latte.Dock.Left)&&(Qt.application.layoutDirection !== Qt.RightToLeft)) + || ((root.panelAlignment === Latte.Dock.Right)&&(Qt.application.layoutDirection === Qt.RightToLeft))) AnchorChanges { target: barLine @@ -668,7 +674,9 @@ Item{ }, State { name: "topRight" - when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === Latte.Dock.Right) + when: (plasmoid.location === PlasmaCore.Types.TopEdge) + &&(((root.panelAlignment === Latte.Dock.Right)&&(Qt.application.layoutDirection !== Qt.RightToLeft)) + ||((root.panelAlignment === Latte.Dock.Left)&&(Qt.application.layoutDirection === Qt.RightToLeft))) AnchorChanges { target: barLine diff --git a/containment/package/contents/ui/ParabolicManager.qml b/containment/package/contents/ui/ParabolicManager.qml index b16f0e647..356d8c112 100644 --- a/containment/package/contents/ui/ParabolicManager.qml +++ b/containment/package/contents/ui/ParabolicManager.qml @@ -81,7 +81,7 @@ Item { //check if the mouse goes right or down according to the center var positiveDirection = ((currentMousePosition - center) >= 0 ); - if (Qt.application.layoutDirection === Qt.RightToLeft) { + if (Qt.application.layoutDirection === Qt.RightToLeft && !root.isVertical) { positiveDirection = !positiveDirection; } diff --git a/containment/package/contents/ui/main.qml b/containment/package/contents/ui/main.qml index ea5e2538a..a4967da38 100644 --- a/containment/package/contents/ui/main.qml +++ b/containment/package/contents/ui/main.qml @@ -38,7 +38,7 @@ DragDrop.DropArea { id: root objectName: "dockLayoutView" - LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft + LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft && !root.isVertical LayoutMirroring.childrenInherit: true //// BEGIN SIGNALS diff --git a/plasmoid/package/contents/ui/ParabolicManager.qml b/plasmoid/package/contents/ui/ParabolicManager.qml index c2b3451fe..dca4d1fdf 100644 --- a/plasmoid/package/contents/ui/ParabolicManager.qml +++ b/plasmoid/package/contents/ui/ParabolicManager.qml @@ -70,7 +70,7 @@ Item { //check if the mouse goes right or down according to the center var positiveDirection = ((currentMousePosition - center) >= 0 ); - if (Qt.application.layoutDirection === Qt.RightToLeft) { + if (Qt.application.layoutDirection === Qt.RightToLeft && !root.vertical) { positiveDirection = !positiveDirection; } diff --git a/plasmoid/package/contents/ui/main.qml b/plasmoid/package/contents/ui/main.qml index 97a542999..fbd2f9532 100644 --- a/plasmoid/package/contents/ui/main.qml +++ b/plasmoid/package/contents/ui/main.qml @@ -50,7 +50,7 @@ Item { Layout.minimumHeight: (userPanelPosition !== 0)&&(!latteDock) ? clearHeight : -1 Layout.preferredWidth: (userPanelPosition !== 0)&&(!latteDock) ? tasksWidth : -1 Layout.preferredHeight: (userPanelPosition !== 0)&&(!latteDock) ? tasksHeight : -1 - LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft + LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft && !root.vertical LayoutMirroring.childrenInherit: true property bool debugLocation: false diff --git a/plasmoid/package/contents/ui/task/TaskIconItem.qml b/plasmoid/package/contents/ui/task/TaskIconItem.qml index 3fe0f8b31..468943701 100644 --- a/plasmoid/package/contents/ui/task/TaskIconItem.qml +++ b/plasmoid/package/contents/ui/task/TaskIconItem.qml @@ -303,7 +303,7 @@ Item{ } property var mask: ShaderEffectSource { sourceItem: Item{ - LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft + LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft && !root.vertical LayoutMirroring.childrenInherit: true width: iconImageBuffer.width