Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
BC
public
external
Qt
QtQuickControls
Commits
a416a5b5
Commit
a416a5b5
authored
13 years ago
by
Richard Moe Gustavsen
Browse files
Options
Download
Patches
Plain Diff
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
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
components/custom/SplitterRow.qml
+10
-9
components/custom/SplitterRow.qml
examples/SplitterGallery.qml
+2
-2
examples/SplitterGallery.qml
with
12 additions
and
11 deletions
components/custom/SplitterRow.qml
+
10
−
9
View file @
a416a5b5
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
examples/SplitterGallery.qml
+
2
−
2
View file @
a416a5b5
...
@@ -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
{
...
...
This diff is collapsed.
Click to expand it.
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets