Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Leander Schulten
Lichtsteuerung
Commits
2cbc5277
Commit
2cbc5277
authored
Oct 08, 2019
by
Leander Schulten
Browse files
GUI: ColorSlider: Make it possible to use the ColorSlider vertical
parent
b8555ed2
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/qml/components/ColorSlider.qml
View file @
2cbc5277
...
...
@@ -8,22 +8,28 @@ Rectangle{
border.width
:
1
property
alias
selectorColor
:
selector
.
color
property
real
value
:
0
property
int
orientation
:
Gradient
.
Horizontal
Rectangle
{
id
:
selector
x
:
1
+
value
*
(
parent
.
width
-
3
)
y
:
1
+
value
*
(
parent
.
height
-
3
)
width
:
1
height
:
1
color
:
"
black
"
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
anchors.top
:
orientation
===
Gradient
.
Horizontal
?
parent
.
top
:
undefined
anchors.bottom
:
orientation
===
Gradient
.
Horizontal
?
parent
.
bottom
:
undefined
anchors.left
:
orientation
===
Gradient
.
Vertical
?
parent
.
left
:
undefined
anchors.right
:
orientation
===
Gradient
.
Vertical
?
parent
.
right
:
undefined
}
Component.onCompleted
:
{
if
(
gradient
){
gradient
.
orientation
=
Gradient
.
Horizontal
;
gradient
.
orientation
=
orientation
;
}
}
MouseArea
{
anchors.fill
:
parent
onMouseXChanged
:
value
=
Math
.
max
(
0
,
Math
.
min
(
1
,
mouseX
/
width
));
onMouseXChanged
:
if
(
orientation
===
Gradient
.
Horizontal
)
value
=
Math
.
max
(
0
,
Math
.
min
(
1
,
mouseX
/
width
));
onMouseYChanged
:
if
(
orientation
===
Gradient
.
Vertical
)
value
=
Math
.
max
(
0
,
Math
.
min
(
1
,
mouseY
/
height
));
}
}
Write
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!
Cancel
Please
register
or
sign in
to comment