diff options
author | Sascha Siebert <sascha.siebert@basyskom.com> | 2017-01-10 18:54:56 +0100 |
---|---|---|
committer | Jan Arve Sæther <jan-arve.saether@qt.io> | 2017-11-22 11:28:16 +0000 |
commit | 59ce8a850d158658c5ed5f2bdc8b9f2013fe4549 (patch) | |
tree | 3331bcbdac1a2980f14b44de091a8a5473c3b40e /tests/auto/quick/qquicklayouts | |
parent | d373d5e7d70e968cfba8957596ed6fe4f46990c8 (diff) |
Fix positioning and placement of initially invisible items in layouts
Instead of misusing implicitWidth/Height as a storage mechanism in
scenarios where width/height is used for preferred size evaluation,
new members are created to hold this information to prevent incorrect
sizing in mentioned scenario and get rid of blocking signals.
Task-number: QTBUG-57455
Change-Id: I102c45805c4106e5829b17b65c2e247b2381573f
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'tests/auto/quick/qquicklayouts')
-rw-r--r-- | tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml index 4346c5283e..4ff1017116 100644 --- a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml +++ b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml @@ -263,6 +263,41 @@ Item { col.destroy() } + function test_dynamicSizeAdaptationsForInitiallyInvisibleItemsInLayout() { + var test_layoutStr = + 'import QtQuick 2.2; \ + import QtQuick.Layouts 1.0; \ + RowLayout { \ + id: row; \ + width: 10; \ + spacing: 0; \ + property alias r1: _r1; \ + Rectangle { \ + id: _r1; \ + visible: false; \ + height: 10; \ + Layout.fillWidth: true; \ + color: "#8080ff"; \ + } \ + property alias r2: _r2; \ + Rectangle { \ + id: _r2; \ + height: 10; \ + Layout.fillWidth: true; \ + color: "#c0c0ff"; \ + } \ + } ' + + var lay = Qt.createQmlObject(test_layoutStr, container, ''); + compare(lay.r1.width, 0) + compare(lay.r2.width, 10) + lay.r1.visible = true; + waitForRendering(lay) + compare(lay.r1.width, 5) + compare(lay.r2.width, 5) + lay.destroy() + } + Component { id: layoutItem_Component Rectangle { |