diff options
author | David Edmundson <davidedmundson@kde.org> | 2020-04-19 15:14:02 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-08-26 16:52:06 +0000 |
commit | 8fdc4307d303ac6588141b16530008b31c00211e (patch) | |
tree | edea98dc0ff84030d5489425b1d4b537beb7a139 /tests | |
parent | 31be20a6fe1bb4b01158f80602109e9d32239745 (diff) |
Follow layoutMirroring in Layout margins
If a layout is laid out left to right using the layoutDirection
property, we want left Margins on the left, and rightMargin still on the
right
However, if a layout is mirrored, not only should the layout direction
change but also the left margin should now be on the right and vice
versa.
Task-number: QTBUG-62989
Change-Id: Iaae4bc436fd1eb7f1947869563ac325f3d6b79bb
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
(cherry picked from commit 16613f3741af013f7e380c98df6889d73512d0ad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml b/tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml index 0fa84a1617..46d18a4384 100644 --- a/tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml +++ b/tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml @@ -991,6 +991,47 @@ Item { } Component { + + id: layout_RTL_Component + GridLayout { + LayoutMirroring.enabled: true + columns: 2 + rowSpacing: 0 + columnSpacing: 0 + Rectangle { + color: "red" + Layout.preferredWidth: 20 + Layout.preferredHeight: 20 + Layout.leftMargin: 2 + Layout.rightMargin: 1 + } + Rectangle { + color: "blue" + Layout.preferredWidth: 20 + Layout.preferredHeight: 20 + Layout.leftMargin: 3 + Layout.rightMargin: 4 + } + } + } + + function test_Rtl() + { + var layout = layout_RTL_Component.createObject(container) + + compare(layout.implicitWidth, 3 + 20 + 4 + 2 + 20 + 1 ) + layout.width = layout.implicitWidth + + waitForRendering(layout) + + var c0 = layout.children[0] + var c1 = layout.children[1] + + compare(c1.x, 4) // c1 is first, with the right margin on the left + compare(c0.x, 20 + 3 + 4 + 1) + } + + Component { id: layout_invalidateWhileRearranging_Component GridLayout { |