summaryrefslogtreecommitdiff
path: root/src/controls/SplitView.qml
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@digia.com>2013-05-03 19:58:46 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-07 10:07:19 +0200
commita2bec5164f81f83a291480197f5f0a92b07ca7fa (patch)
tree0e3f85803a4a162a1ba089bac8b4acbc59343c5f /src/controls/SplitView.qml
parentab936c26d8246a1e8d1e80ec6be737449fb9770b (diff)
downloadqtquickcontrols-a2bec5164f81f83a291480197f5f0a92b07ca7fa.tar.gz
SplitView: always respect min/max
If the user sets Layout.maximumWidth on the fillWidth item, we now respect it. This can potentially make the splitview look buggy, since the fillWidth item might then be restrained from filling out remaining space. The same with the height of each item; you can now control the maximum height. This means that each item can end up with a different height. The upshot is that if you add items to a splitview that cannot grow, splitview will not try to resize it. Change-Id: If1cc82aefa939898a3b159da6b006f95af42599f Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Diffstat (limited to 'src/controls/SplitView.qml')
-rw-r--r--src/controls/SplitView.qml9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/controls/SplitView.qml b/src/controls/SplitView.qml
index f1251399..0c50bc3b 100644
--- a/src/controls/SplitView.qml
+++ b/src/controls/SplitView.qml
@@ -284,8 +284,11 @@ Item {
// it already got, and assume that SplitView ends up with implicit size as size:
if (root[d.size] != 0) {
var fillItem = __items[fillIndex]
- var min = fillItem.Layout[minimum] !== undefined ? fillItem.Layout[minimum] : 0
- fillItem[d.size] = Math.max(min, root[d.size] - d.accumulatedSize(0, __items.length, false))
+ var superfluous = root[d.size] - d.accumulatedSize(0, __items.length, false)
+ var s = Math.max(superfluous, fillItem.Layout[minimum])
+ if (fillItem.Layout[maximum] !== -1)
+ s = Math.min(s, fillItem.Layout[maximum])
+ fillItem[d.size] = s
}
// Position items and handles according to their width:
@@ -296,7 +299,7 @@ Item {
if (item.visible) {
item[d.offset] = lastVisibleHandle ? lastVisibleHandle[d.offset] + lastVisibleHandle[d.size] : 0
item[d.otherOffset] = 0
- item[d.otherSize] = root[d.otherSize]
+ item[d.otherSize] = clampedMinMax(root[otherSize], item.Layout[otherMinimum], item.Layout[otherMaximum])
lastVisibleItem = item
handle = __handles[i]