forked from qt-creator/qt-creator
QmlDesigner: Fix validation on integer spinboxes
Now spinboxes use IntValidator if decimals is set to zero. Fixes: QDS-11922 Change-Id: Ibe8c8a18294a6764a0cd2182d09c30cdf9fb27cc Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -95,7 +95,7 @@ T.SpinBox {
|
||||
control.focus = false
|
||||
}
|
||||
|
||||
validator: DoubleValidator {
|
||||
DoubleValidator {
|
||||
id: doubleValidator
|
||||
locale: control.locale.name
|
||||
notation: DoubleValidator.StandardNotation
|
||||
@@ -104,6 +104,15 @@ T.SpinBox {
|
||||
top: Math.max(control.realFrom, control.realTo)
|
||||
}
|
||||
|
||||
IntValidator {
|
||||
id: intValidator
|
||||
locale: control.locale.name
|
||||
bottom: Math.round(Math.min(control.realFrom, control.realTo))
|
||||
top: Math.round(Math.max(control.realFrom, control.realTo))
|
||||
}
|
||||
|
||||
validator: control.decimals === 0 ? intValidator : doubleValidator
|
||||
|
||||
ActionIndicator {
|
||||
id: actionIndicator
|
||||
style: control.style
|
||||
@@ -153,7 +162,7 @@ T.SpinBox {
|
||||
id: spinBoxInput
|
||||
style: control.style
|
||||
__parentControl: control
|
||||
validator: doubleValidator
|
||||
validator: control.validator
|
||||
|
||||
function handleEditingFinished() {
|
||||
control.checkAndClearFocus()
|
||||
|
Reference in New Issue
Block a user