mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 06:48:04 +02:00
couple Spinbox fixes:
- stop resetting value in 'valueFromText'. The issue with such approach is that is is not possible to understand whether value was really changed or, for example, focus did change - instead, propagate validator to TextInput which makes not possible to type bad text (which eliminate the reason for original fix) - specify correct inputMethodHints to guide onscreen keyboards
This commit is contained in:
parent
0a28361dc8
commit
e900e034a3
1 changed files with 3 additions and 1 deletions
|
@ -21,6 +21,7 @@ SpinBox {
|
||||||
id: hifi
|
id: hifi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inputMethodHints: Qt.ImhFormattedNumbersOnly
|
||||||
property int colorScheme: hifi.colorSchemes.light
|
property int colorScheme: hifi.colorSchemes.light
|
||||||
readonly property bool isLightColorScheme: colorScheme === hifi.colorSchemes.light
|
readonly property bool isLightColorScheme: colorScheme === hifi.colorSchemes.light
|
||||||
property string label: ""
|
property string label: ""
|
||||||
|
@ -91,7 +92,6 @@ SpinBox {
|
||||||
}
|
}
|
||||||
|
|
||||||
valueFromText: function(text, locale) {
|
valueFromText: function(text, locale) {
|
||||||
spinBox.value = 0; // Force valueChanged signal to be emitted so that validator fires.
|
|
||||||
return Number.fromLocaleString(locale, text)*factor;
|
return Number.fromLocaleString(locale, text)*factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +104,8 @@ SpinBox {
|
||||||
selectedTextColor: hifi.colors.black
|
selectedTextColor: hifi.colors.black
|
||||||
selectionColor: hifi.colors.primaryHighlight
|
selectionColor: hifi.colors.primaryHighlight
|
||||||
text: spinBox.textFromValue(spinBox.value, spinBox.locale) + suffix
|
text: spinBox.textFromValue(spinBox.value, spinBox.locale) + suffix
|
||||||
|
inputMethodHints: spinBox.inputMethodHints
|
||||||
|
validator: spinBox.validator
|
||||||
verticalAlignment: Qt.AlignVCenter
|
verticalAlignment: Qt.AlignVCenter
|
||||||
leftPadding: spinBoxLabelInside.visible ? 30 : hifi.dimensions.textPadding
|
leftPadding: spinBoxLabelInside.visible ? 30 : hifi.dimensions.textPadding
|
||||||
//rightPadding: hifi.dimensions.spinnerSize
|
//rightPadding: hifi.dimensions.spinnerSize
|
||||||
|
|
Loading…
Reference in a new issue