QmlDesigner: Update Hue/OpacitySlider handle

* Update the look of the HueSlider and OpacitySlider handle to be more
  visible and at the same time show the picked color/transparency
* Fix undefined warning in ExtendedFunctionLogic

Change-Id: Ib593a385f80f199e80aeff5a862efb22aca88c3a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Henning Gruendl
2021-07-09 16:15:00 +02:00
committed by Henning Gründl
parent f490ea44fd
commit 0ba7c5c0d5
3 changed files with 23 additions and 15 deletions

View File

@@ -61,7 +61,7 @@ Item {
extendedFunctionButton.color = StudioTheme.Values.themeInteraction extendedFunctionButton.color = StudioTheme.Values.themeInteraction
} }
} else { } else {
if (backendValue.complexNode !== null if (backendValue.complexNode !== undefined
&& backendValue.complexNode.exists) { && backendValue.complexNode.exists) {
} else { } else {

View File

@@ -42,7 +42,7 @@ Item {
function updatePos() { function updatePos() {
if (root.maximum > root.minimum) { if (root.maximum > root.minimum) {
var pos = (track.width - handle.width) * (root.value - root.minimum) / (root.maximum - root.minimum) var pos = (track.width - handle.width) * (root.value - root.minimum) / (root.maximum - root.minimum)
return Math.min(Math.max(pos, 0), track.width - 8) return Math.min(Math.max(pos, 0), track.width - handle.width)
} else { } else {
return 0 return 0
} }
@@ -74,20 +74,24 @@ Item {
Rectangle { Rectangle {
id: handle id: handle
width: StudioTheme.Values.hueSliderHandleWidth width: StudioTheme.Values.hueSliderHandleWidth
height: track.height height: track.height - 4
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
smooth: true smooth: true
opacity: 0.9 color: "transparent"
radius: 2 radius: 2
border.color: "black" border.color: "black"
border.width: 1 border.width: 1
x: root.updatePos() x: root.updatePos()
y: 2
z: 1 z: 1
gradient: Gradient { Rectangle {
GradientStop {color: "#2c2c2c" ; position: 0} anchors.fill: parent
GradientStop {color: "#343434" ; position: 0.15} anchors.margins: 1
GradientStop {color: "#373737" ; position: 1.0} color: "transparent"
radius: 1
border.color: "white"
border.width: 1
} }
} }

View File

@@ -43,7 +43,7 @@ Item {
function updatePos() { function updatePos() {
if (root.maximum > root.minimum) { if (root.maximum > root.minimum) {
var pos = (track.width - handle.width) * (root.value - root.minimum) / (root.maximum - root.minimum) var pos = (track.width - handle.width) * (root.value - root.minimum) / (root.maximum - root.minimum)
return Math.min(Math.max(pos, 0), track.width - 8) return Math.min(Math.max(pos, 0), track.width - handle.width)
} else { } else {
return 0 return 0
} }
@@ -77,20 +77,24 @@ Item {
Rectangle { Rectangle {
id: handle id: handle
width: StudioTheme.Values.hueSliderHandleWidth width: StudioTheme.Values.hueSliderHandleWidth
height: track.height height: track.height - 4
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
smooth: true smooth: true
opacity: 0.9 color: "transparent"
radius: 2 radius: 2
border.color: "black" border.color: "black"
border.width: 1 border.width: 1
x: root.updatePos() x: root.updatePos()
y: 2
z: 1 z: 1
gradient: Gradient { Rectangle {
GradientStop {color: "#2c2c2c" ; position: 0} anchors.fill: parent
GradientStop {color: "#343434" ; position: 0.15} anchors.margins: 1
GradientStop {color: "#373737" ; position: 1.0} color: "transparent"
radius: 1
border.color: "white"
border.width: 1
} }
} }