From 2c22f6445f69d12afac01e3fd74d21decc14d4b3 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 10 Jul 2013 15:08:12 +0200 Subject: SplitView: Always layout as if fillWidthItem is visible Hiding the fillWidth item in the splitter is allowed, but causes strange drawing/layout artifacts that can be difficult to understand since the layout engine would ignore all hidden items. This patch changes the implementation by adding an exception to the rule. The layout engine now treats the fillWidth item as if it is always visible. Then, hiding it would just reveal a white field where the fillItem would otherwise be, but the layout would otherwise look correct. Change-Id: I95ec51b595109e8f1efdc231c9a6697ee60aa483 Reviewed-by: Jens Bache-Wiig --- src/controls/SplitView.qml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/controls/SplitView.qml') diff --git a/src/controls/SplitView.qml b/src/controls/SplitView.qml index 29d812a4..439d9053 100644 --- a/src/controls/SplitView.qml +++ b/src/controls/SplitView.qml @@ -213,7 +213,7 @@ Item { function updateFillIndex() { - if (!lastItem.visible) + if (lastItem.visible !== root.visible) return var policy = (root.orientation === Qt.Horizontal) ? "fillWidth" : "fillHeight" for (var i=0; i<__items.length-1; ++i) { @@ -294,7 +294,7 @@ Item { var w = 0 for (var i=firstIndex; i __handleIndex) ? 0 : 1)].visible + property bool resizeLeftItem: (d.fillIndex > __handleIndex) + visible: __items[__handleIndex + (resizeLeftItem ? 0 : 1)].visible sourceComponent: handleDelegate onWidthChanged: d.updateLayout() onHeightChanged: d.updateLayout() @@ -409,8 +410,7 @@ Item { var leftEdge, rightEdge, newWidth, leftStopX, rightStopX var i - if (d.fillIndex > __handleIndex) { - // Resize item to the left. + if (resizeLeftItem) { // Ensure that the handle is not crossing other handles. So // find the first visible handle to the left to determine the left edge: leftEdge = 0 -- cgit v1.2.1