Skip to content

Commit 85d4cf0

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 3bf58b2 commit 85d4cf0

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
@@ -35,7 +35,10 @@ ColumnLayout {
3535
dbcacheSetting.forceActiveFocus()
3636
}
3737
}
38-
onClicked: loadedItem.forceActiveFocus()
38+
onClicked: {
39+
loadedItem.filled = true
40+
loadedItem.forceActiveFocus()
41+
}
3942
}
4043
Separator { Layout.fillWidth: true }
4144
Setting {
@@ -50,7 +53,10 @@ ColumnLayout {
5053
parSetting.forceActiveFocus()
5154
}
5255
}
53-
onClicked: loadedItem.forceActiveFocus()
56+
onClicked: {
57+
loadedItem.filled = true
58+
loadedItem.forceActiveFocus()
59+
}
5460
}
5561
Separator { Layout.fillWidth: true }
5662
Setting {

src/qml/components/StorageSettings.qml

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

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)