Skip to content

Commit 26aa64c

Browse files
committed
qml: add EMPTY state to ValueInput
The EMPTY state indicates that this setting hasn't been touched. Clicking on the Setting that contains the ValueInput is enough to put it in the FILLED state.
1 parent 565651a commit 26aa64c

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

src/qml/components/DeveloperOptions.qml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ ColumnLayout {
3434
dbcacheSetting.forceActiveFocus()
3535
}
3636
}
37-
onClicked: loadedItem.forceActiveFocus()
37+
onClicked: {
38+
loadedItem.filled = true
39+
loadedItem.forceActiveFocus()
40+
}
3841
}
3942
Setting {
4043
id: parSetting
@@ -48,7 +51,10 @@ ColumnLayout {
4851
parSetting.forceActiveFocus()
4952
}
5053
}
51-
onClicked: loadedItem.forceActiveFocus()
54+
onClicked: {
55+
loadedItem.filled = true
56+
loadedItem.forceActiveFocus()
57+
}
5258
}
5359
Setting {
5460
Layout.fillWidth: true

src/qml/components/StorageSettings.qml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ ColumnLayout {
4040
pruneTargetSetting.forceActiveFocus()
4141
}
4242
}
43-
onClicked: loadedItem.forceActiveFocus()
43+
onClicked: {
44+
loadedItem.filled = true
45+
loadedItem.forceActiveFocus()
46+
}
4447
}
4548
}

src/qml/controls/ValueInput.qml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,33 @@ TextInput {
99
id: root
1010
required property string parentState
1111
property string description: ""
12+
property bool filled: false
1213
property int descriptionSize: 18
1314
property color textColor
14-
state: root.parentState
1515

1616
states: [
1717
State {
18-
name: "FILLED"
18+
name: "EMPTY"; when: !filled
19+
PropertyChanges { target: root; textColor: Theme.color.neutral5 }
20+
},
21+
State {
22+
name: "FILLED"; when: filled && !(parentState == "HOVER") && !(parentState == "ACTIVE") && !(parentState == "DISABLED")
1923
PropertyChanges {
2024
target: root
2125
enabled: true
2226
textColor: Theme.color.neutral9
2327
}
2428
},
2529
State {
26-
name: "HOVER"
30+
name: "HOVER"; when: (parentState == "HOVER") && filled
2731
PropertyChanges { target: root; textColor: Theme.color.orangeLight1 }
2832
},
2933
State {
30-
name: "ACTIVE"
34+
name: "ACTIVE"; when: (parentState == "ACTIVE")
3135
PropertyChanges { target: root; textColor: Theme.color.orange }
3236
},
3337
State {
34-
name: "DISABLED"
38+
name: "DISABLED"; when: (parentState == "DISABLED")
3539
PropertyChanges {
3640
target: root
3741
enabled: false

0 commit comments

Comments
 (0)