diff options
| author | Richard Moe Gustavsen <richard.gustavsen@digia.com> | 2013-07-10 14:49:18 +0200 |
|---|---|---|
| committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-11 18:26:23 +0200 |
| commit | a741101c3cc4d8e5ceb36a299914c2e92d78e505 (patch) | |
| tree | bcf9dad5d3ed0450a9d4a4ae0385ea01afa6f936 | |
| parent | 2c4f86faafff1f68783f9c813a551ad7244fdb62 (diff) | |
| download | qtquickcontrols-a741101c3cc4d8e5ceb36a299914c2e92d78e505.tar.gz | |
SplitView: bugfix hiding splitter for last item
Change-Id: I8953d7fa4f1a1a940029270d4cb8f3d69da07bf7
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
| -rw-r--r-- | src/controls/SplitView.qml | 6 | ||||
| -rw-r--r-- | tests/auto/controls/data/tst_splitview.qml | 38 |
2 files changed, 41 insertions, 3 deletions
diff --git a/src/controls/SplitView.qml b/src/controls/SplitView.qml index 2dbbbf75..29d812a4 100644 --- a/src/controls/SplitView.qml +++ b/src/controls/SplitView.qml @@ -301,7 +301,7 @@ Item { w += item.Layout[minimum] var handle = __handles[i] - if (handle) + if (handle && handle.visible) w += handle[d.size] } } @@ -351,7 +351,7 @@ Item { lastVisibleItem = item handle = __handles[i] - if (handle) { + if (handle && handle.visible) { handle[d.offset] = lastVisibleItem[d.offset] + Math.max(0, lastVisibleItem[d.size]) handle[d.otherOffset] = 0 handle[d.otherSize] = root[d.otherSize] @@ -377,7 +377,7 @@ Item { readonly property bool resizing: mouseArea.drag.active onResizingChanged: root.resizing = resizing } - visible: __items[__handleIndex + ((d.fillIndex >= __handleIndex) ? 0 : 1)].visible + visible: __items[__handleIndex + ((d.fillIndex > __handleIndex) ? 0 : 1)].visible sourceComponent: handleDelegate onWidthChanged: d.updateLayout() onHeightChanged: d.updateLayout() diff --git a/tests/auto/controls/data/tst_splitview.qml b/tests/auto/controls/data/tst_splitview.qml index 793844ff..05bc16be 100644 --- a/tests/auto/controls/data/tst_splitview.qml +++ b/tests/auto/controls/data/tst_splitview.qml @@ -140,4 +140,42 @@ TestCase { compare (view.item2.height, 500) view.destroy() } + + function test_04_hide_item() + { + var component = splitView + var view = component.createObject(testCase); + verify (view.item1.visible) + verify (view.item2.visible) + view.item1.visible = false + verify (view.item1.visible === false) + + compare (view.item1.x, 0) + compare (view.item1.y, 0) + compare (view.item1.width, 100) + compare (view.item1.height, 500) + compare (view.item2.x, 0) + compare (view.item2.y, 0) + compare (view.item2.width, testCase.width) + compare (view.item2.height, 500) + } + + function test_05_hide_fillWidth_item() + { + var component = splitView + var view = component.createObject(testCase); + verify (view.item1.visible) + verify (view.item2.visible) + view.item2.visible = false + verify (view.item2.visible === false) + + compare (view.item1.x, 0) + compare (view.item1.y, 0) + compare (view.item1.width, 100) + compare (view.item1.height, 500) + compare (view.item2.x, view.item1.x + view.item1.width + handleWidth) + compare (view.item2.y, 0) + compare (view.item2.width, testCase.width - view.item1.width - handleWidth) + compare (view.item2.height, 500) + } } |
