Skip to content

Commit 970c66f

Browse files
committed
qml: add Hover,Filled, and Active color interaction states to ValueInput
1 parent c9ef4b1 commit 970c66f

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

src/qml/components/DeveloperOptions.qml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,21 @@ ColumnLayout {
2323
onClicked: loadedItem.clicked()
2424
}
2525
Setting {
26+
id: dbcacheSetting
2627
Layout.fillWidth: true
2728
header: qsTr("Database cache size")
2829
actionItem: ValueInput {
30+
parentState: dbcacheSetting.state
2931
description: ("450 MiB")
3032
}
3133
onClicked: loadedItem.forceActiveFocus()
3234
}
3335
Setting {
36+
id: parSetting
3437
Layout.fillWidth: true
3538
header: qsTr("Script verification threads")
3639
actionItem: ValueInput {
40+
parentState: parSetting.state
3741
description: ("0")
3842
}
3943
onClicked: loadedItem.forceActiveFocus()

src/qml/components/StorageSettings.qml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ ColumnLayout {
2222
}
2323
}
2424
Setting {
25+
id: pruneTargetSetting
2526
Layout.fillWidth: true
2627
header: qsTr("Storage limit (GB)")
2728
actionItem: ValueInput {
29+
parentState: pruneTargetSetting.state
2830
description: optionsModel.pruneSizeGB
2931
onEditingFinished: optionsModel.pruneSizeGB = parseInt(text)
3032
}

src/qml/controls/ValueInput.qml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,36 @@ import QtQuick.Controls 2.15
77

88
TextEdit {
99
id: root
10+
required property string parentState
1011
property string description: ""
1112
property int descriptionSize: 18
13+
property color textColor
14+
state: root.parentState
15+
16+
states: [
17+
State {
18+
name: "FILLED"
19+
PropertyChanges { target: root; textColor: Theme.color.neutral9 }
20+
},
21+
State {
22+
name: "HOVER"
23+
PropertyChanges { target: root; textColor: Theme.color.orangeLight1 }
24+
},
25+
State {
26+
name: "ACTIVE"
27+
PropertyChanges { target: root; textColor: Theme.color.orange }
28+
}
29+
]
1230

1331
font.family: "Inter"
1432
font.styleName: "Regular"
1533
font.pixelSize: root.descriptionSize
16-
color: Theme.color.neutral8
34+
color: root.textColor
1735
text: description
1836
horizontalAlignment: Text.AlignRight
1937
wrapMode: Text.WordWrap
38+
39+
Behavior on color {
40+
ColorAnimation { duration: 150 }
41+
}
2042
}

0 commit comments

Comments
 (0)