diff options
author | Richard Moe Gustavsen <richard.gustavsen@digia.com> | 2013-09-18 10:22:39 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-19 09:17:24 +0200 |
commit | 09a74592234c84b3e428b452d844eaa1f6451040 (patch) | |
tree | f1e391eb3a6f897c8d3506db8914ba4be7a638e8 /src/controls/SplitView.qml | |
parent | 04e000d2b1719696581bb4ae6ec21e39236ef38c (diff) | |
download | qtquickcontrols-09a74592234c84b3e428b452d844eaa1f6451040.tar.gz |
SplitView: fix hidden item after fillWidth item bugold/5.1
Some of the calculations in SplitView assumed that if
item with index i was hidden, then so was handle at
index i as well. This is not correct. The reason is
that a the handle at i belongs to either item i
or item i+1, depending on where the fillWidth item is.
And this caused a bug when hiding the item to the
right of the fillWidth item.
Conflicts:
tests/auto/controls/data/tst_splitview.qml
Change-Id: I59967813f264a856181c57e32c4820d09d7eb363
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src/controls/SplitView.qml')
-rw-r--r-- | src/controls/SplitView.qml | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/controls/SplitView.qml b/src/controls/SplitView.qml index 1cc8199f..57f6633f 100644 --- a/src/controls/SplitView.qml +++ b/src/controls/SplitView.qml @@ -293,17 +293,18 @@ Item { // calculate their acummulated width. var w = 0 for (var i=firstIndex; i<lastIndex; ++i) { + var item = __items[i] if (item.visible || i == d.fillIndex) { if (i !== d.fillIndex) w += item[d.size]; else if (includeFillItemMinimum && item.Layout[minimum] !== undefined) w += item.Layout[minimum] - - var handle = __handles[i] - if (handle && handle.visible) - w += handle[d.size] } + + var handle = __handles[i] + if (handle && handle.visible) + w += handle[d.size] } return w } @@ -351,14 +352,14 @@ Item { item[d.otherOffset] = 0 item[d.otherSize] = clampedMinMax(root[otherSize], item.Layout[otherMinimum], item.Layout[otherMaximum]) lastVisibleItem = item + } - handle = __handles[i] - 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] - lastVisibleHandle = handle - } + handle = __handles[i] + 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] + lastVisibleHandle = handle } } |