QmlDesigner: Fix SpinBoxIndicator hover/edit state

* Make global hover work on disabled SpinBoxIndicator
* Fix disabled state not showing in edit mode
* Hide/blend indicator on drag operation
* Some color changes

Task-number: QDS-5970
Task-number: QDS-5975
Change-Id: I4965b4c6ad906fe05f8a43cabb1914e15a23ba7d
Reviewed-by: Brook Cronin <brook.cronin@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Henning Gruendl
2022-01-24 17:04:06 +01:00
committed by Henning Gründl
parent 7c38ee31e3
commit 94bf7a656f

View File

@@ -32,7 +32,7 @@ Rectangle {
property T.Control myControl
property bool hover: spinBoxIndicatorMouseArea.containsMouse && spinBoxIndicator.enabled
property bool hover: spinBoxIndicatorMouseArea.containsMouse
property bool pressed: spinBoxIndicatorMouseArea.containsPress
property bool released: false
property bool realEnabled: true
@@ -112,7 +112,6 @@ Rectangle {
id: spinBoxIndicatorIcon
text: StudioTheme.Constants.upDownSquare2
color: StudioTheme.Values.themeTextColor
renderType: Text.NativeRendering
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: StudioTheme.Values.spinControlIconSizeMulti
@@ -126,6 +125,15 @@ Rectangle {
}
states: [
State {
name: "default"
when: myControl.enabled && spinBoxIndicator.enabled && !myControl.edit
&& !spinBoxIndicator.hover && !myControl.hover && !myControl.drag
PropertyChanges {
target: spinBoxIndicatorIcon
color: StudioTheme.Values.themeTextColor
}
},
State {
name: "globalHover"
when: myControl.enabled && spinBoxIndicator.enabled && !myControl.drag
@@ -150,12 +158,12 @@ Rectangle {
&& spinBoxIndicator.pressed
PropertyChanges {
target: spinBoxIndicatorIcon
color: "#323232" // TODO
color: StudioTheme.Values.themeIconColor
}
},
State {
name: "edit"
when: myControl.edit
when: myControl.edit && spinBoxIndicator.enabled
PropertyChanges {
target: spinBoxIndicatorIcon
color: StudioTheme.Values.themeTextColor
@@ -201,7 +209,7 @@ Rectangle {
},
State {
name: "hover"
when: myControl.enabled && !myControl.drag
when: myControl.enabled && !myControl.drag && spinBoxIndicator.enabled
&& spinBoxIndicator.hover && myControl.hover && !spinBoxIndicator.pressed
PropertyChanges {
target: spinBoxIndicatorIcon
@@ -227,7 +235,7 @@ Rectangle {
},
State {
name: "edit"
when: myControl.edit
when: myControl.edit && myControl.enabled && spinBoxIndicator.enabled
PropertyChanges {
target: spinBoxIndicatorIcon
visible: true
@@ -239,7 +247,7 @@ Rectangle {
},
State {
name: "drag"
when: myControl.drag
when: myControl.drag && myControl.enabled
PropertyChanges {
target: spinBoxIndicatorIcon
visible: false