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:
Alexander Ivash 2018-08-09 02:21:27 +03:00
parent 0a28361dc8
commit e900e034a3

View file

@ -21,6 +21,7 @@ SpinBox {
id: hifi
}
inputMethodHints: Qt.ImhFormattedNumbersOnly
property int colorScheme: hifi.colorSchemes.light
readonly property bool isLightColorScheme: colorScheme === hifi.colorSchemes.light
property string label: ""
@ -91,7 +92,6 @@ SpinBox {
}
valueFromText: function(text, locale) {
spinBox.value = 0; // Force valueChanged signal to be emitted so that validator fires.
return Number.fromLocaleString(locale, text)*factor;
}
@ -104,6 +104,8 @@ SpinBox {
selectedTextColor: hifi.colors.black
selectionColor: hifi.colors.primaryHighlight
text: spinBox.textFromValue(spinBox.value, spinBox.locale) + suffix
inputMethodHints: spinBox.inputMethodHints
validator: spinBox.validator
verticalAlignment: Qt.AlignVCenter
leftPadding: spinBoxLabelInside.visible ? 30 : hifi.dimensions.textPadding
//rightPadding: hifi.dimensions.spinnerSize