Commit a416a5b5 authored by Richard Moe Gustavsen's avatar Richard Moe Gustavsen
Browse files

Splitter: reduce var assignments

parent 789ad8ce
6.2 5.10 5.11 5.12 5.12.1 5.12.10 5.12.11 5.12.12 5.12.2 5.12.3 5.12.4 5.12.5 5.12.6 5.12.7 5.12.8 5.12.9 5.13 5.13.0 5.13.1 5.13.2 5.14 5.14.0 5.14.1 5.14.2 5.15 5.15.0 5.15.1 5.15.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 5.9.8 dev old/5.1 old/5.2 old/qt4 wip/calendar wip/qt5-nativetext wip/tizen v5.15.0-alpha1 v5.14.1 v5.14.0 v5.14.0-rc2 v5.14.0-rc1 v5.14.0-beta3 v5.14.0-beta2 v5.14.0-beta1 v5.14.0-alpha1 v5.13.2 v5.13.1 v5.13.0 v5.13.0-rc3 v5.13.0-rc2 v5.13.0-rc1 v5.13.0-beta4 v5.13.0-beta3 v5.13.0-beta2 v5.13.0-beta1 v5.13.0-alpha1 v5.12.7 v5.12.6 v5.12.5 v5.12.4 v5.12.3 v5.12.2 v5.12.1 v5.12.0 v5.12.0-rc2 v5.12.0-rc1 v5.12.0-beta4 v5.12.0-beta3 v5.12.0-beta2 v5.12.0-beta1 v5.12.0-alpha1 v5.11.3 v5.11.2 v5.11.1 v5.11.0 v5.11.0-rc2 v5.11.0-rc1 v5.11.0-beta4 v5.11.0-beta3 v5.11.0-beta2 v5.11.0-beta1 v5.11.0-alpha1 v5.10.1 v5.10.0 v5.10.0-rc3 v5.10.0-rc2 v5.10.0-rc1 v5.10.0-beta4 v5.10.0-beta3 v5.10.0-beta2 v5.10.0-beta1 v5.10.0-alpha1 v5.9.9 v5.9.8 v5.9.7 v5.9.6 v5.9.5 v5.9.4 v5.9.3 v5.9.2 v5.9.1 v5.9.0 v5.9.0-rc2 v5.9.0-rc1 v5.9.0-beta4 v5.9.0-beta3 v5.9.0-beta2 v5.9.0-beta1 v5.9.0-alpha1 v5.8.0 v5.8.0-rc1 v5.8.0-beta1 v5.8.0-alpha1 v5.7.1 v5.7.0 v5.7.0-rc1 v5.7.0-beta1 v5.7.0-alpha1 v5.6.3 v5.6.2 v5.6.1 v5.6.1-1 v5.6.0 v5.6.0-rc1 v5.6.0-beta1 v5.6.0-alpha1 v5.5.1 v5.5.0 v5.5.0-rc1 v5.5.0-beta1 v5.5.0-alpha1 v5.4.2 v5.4.1 v5.4.0 v5.4.0-rc1 v5.4.0-beta1 v5.4.0-alpha1 v5.3.2 v5.3.1 v5.3.0 v5.3.0-rc1 v5.3.0-beta1 v5.3.0-alpha1 v5.2.1 v5.2.0 v5.2.0-rc1 v5.2.0-beta1 v5.2.0-alpha1 v5.1.1 v5.1.0 v5.1.0-rc2 v5.1.0-rc1 v5.1.0-beta1 v5.1.0-alpha1
No related merge requests found
Showing with 12 additions and 11 deletions
...@@ -32,19 +32,16 @@ Item { ...@@ -32,19 +32,16 @@ Item {
// 'updateLayout' will override in case new width violates max/min. // 'updateLayout' will override in case new width violates max/min.
// And 'updateLayout will be triggered when an item changes width. // And 'updateLayout will be triggered when an item changes width.
// [leftHandle - leftItem - handle - rightItem - rightHandle] var leftHandle, leftItem, handle, rightItem, rightHandle
var leftHandle = handles[handleIndex-1] var leftEdge, rightEdge
var leftItem = items[handleIndex]
var handle = handles[handleIndex]
var rightItem = items[handleIndex+1]
var rightHandle = handles[handleIndex+1]
var leftEdge = leftHandle ? (leftHandle.x + leftHandle.width) : 0
var rightEdge = (rightHandle ? rightHandle.x : root.width)
var expandingItem = items[d.expandingIndex]
if (d.expandingIndex > handleIndex) { if (d.expandingIndex > handleIndex) {
// Resize item to the left. // Resize item to the left.
// Ensure that the handle is not crossing other handles: // Ensure that the handle is not crossing other handles:
leftHandle = handles[handleIndex-1]
leftItem = items[handleIndex]
handle = handles[handleIndex]
leftEdge = leftHandle ? (leftHandle.x + leftHandle.width) : 0
handle.x = Math.max(leftEdge, handle.x) handle.x = Math.max(leftEdge, handle.x)
leftItem.width = handle.x - leftEdge leftItem.width = handle.x - leftEdge
if (root.width != 0 && leftItem.percentageWidth != undefined && leftItem.percentageWidth !== -1) if (root.width != 0 && leftItem.percentageWidth != undefined && leftItem.percentageWidth !== -1)
...@@ -56,6 +53,10 @@ Item { ...@@ -56,6 +53,10 @@ Item {
// we got space for: // we got space for:
var min = accumulatedWidth(0, handleIndex+1, true) var min = accumulatedWidth(0, handleIndex+1, true)
// Ensure that the handle is not crossing other handles: // Ensure that the handle is not crossing other handles:
handle = handles[handleIndex]
rightItem = items[handleIndex+1]
rightHandle = handles[handleIndex+1]
rightEdge = (rightHandle ? rightHandle.x : root.width)
handle.x = Math.max(min, Math.max(Math.min((rightEdge - handle.width), handle.x))) handle.x = Math.max(min, Math.max(Math.min((rightEdge - handle.width), handle.x)))
rightItem.width = rightEdge - (handle.x + handle.width) rightItem.width = rightEdge - (handle.x + handle.width)
if (root.width != 0 && rightItem.percentageWidth != undefined && rightItem.percentageWidth !== -1) if (root.width != 0 && rightItem.percentageWidth != undefined && rightItem.percentageWidth !== -1)
......
...@@ -14,7 +14,7 @@ Rectangle { ...@@ -14,7 +14,7 @@ Rectangle {
id: r1 id: r1
// property bool expanding: true // property bool expanding: true
// property int maximumWidth: 100 // property int maximumWidth: 100
// property real percentageWidth: 50 property real percentageWidth: 50
color: "gray" color: "gray"
width: slider.value width: slider.value
// Behavior on width { PropertyAnimation{} } // Behavior on width { PropertyAnimation{} }
...@@ -23,7 +23,7 @@ Rectangle { ...@@ -23,7 +23,7 @@ Rectangle {
id: r2 id: r2
property int minimumWidth: 50 property int minimumWidth: 50
color: "darkGray" color: "darkGray"
// property bool expanding: true property bool expanding: true
width: 50 width: 50
} }
Slider { Slider {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment