fix(SlippageSelector): remember previous custom value

do not overwrite it and display the Custom button when we click one of
the predefined buttons
This commit is contained in:
Lukáš Tinkl 2024-05-27 15:21:35 +02:00 committed by Lukáš Tinkl
parent 9eba61e18c
commit 3a4764b217
1 changed files with 4 additions and 3 deletions

View File

@ -26,13 +26,14 @@ Control {
} }
Component.onCompleted: { Component.onCompleted: {
buttons.model.append(d.values.map(i => ({ text: "%L1 %".arg(i), value: i }))) buttons.model.append(d.values.map(i => ({ text: "%L1 %2".arg(i).arg(d.customSymbol), value: i })))
valueChanged() valueChanged()
} }
QtObject { QtObject {
id: d id: d
readonly property string customSymbol: "%"
readonly property var values: [0.1, 0.5, 1] readonly property var values: [0.1, 0.5, 1]
property bool internalUpdate: false property bool internalUpdate: false
@ -60,7 +61,6 @@ Control {
return return
d.update(value) d.update(value)
customButton.visible = true
} }
} }
@ -87,8 +87,9 @@ Control {
visible: !customButton.visible visible: !customButton.visible
minValue: 0.01 minValue: 0.01
maxValue: 100.0 maxValue: 100.0
currencySymbol: "%" currencySymbol: d.customSymbol
onValueChanged: d.update(value) onValueChanged: d.update(value)
onFocusChanged: if (focus) d.update(value)
} }
} }
} }