forked from qt-creator/qt-creator
QmlDesigner: Fix SpinBox value reset on focus loss
Task-number: QDS-9770 Change-Id: I8a4d73e7abe8dbb5c62c571fc9980a0f78a5f819 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
committed by
Henning Gründl
parent
8401dc64b5
commit
ba91f9e3e0
@@ -288,22 +288,22 @@ T.SpinBox {
|
|||||||
}
|
}
|
||||||
onRealValueModified: myTimer.restart()
|
onRealValueModified: myTimer.restart()
|
||||||
onFocusChanged: {
|
onFocusChanged: {
|
||||||
if (control.focus) {
|
if (control.focus)
|
||||||
control.dirty = false
|
control.dirty = false
|
||||||
} else {
|
|
||||||
// Make sure displayed value is correct after focus loss, as onEditingFinished
|
|
||||||
// doesn't trigger when value is something validator doesn't accept.
|
|
||||||
spinBoxInput.text = control.textFromValue(control.realValue, control.locale)
|
|
||||||
|
|
||||||
if (control.dirty)
|
|
||||||
spinBoxInput.handleEditingFinished()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
onDisplayTextChanged: spinBoxInput.text = control.displayText
|
onDisplayTextChanged: spinBoxInput.text = control.displayText
|
||||||
onActiveFocusChanged: {
|
onActiveFocusChanged: {
|
||||||
if (control.activeFocus) { // QTBUG-75862 && mySpinBox.focusReason === Qt.TabFocusReason)
|
if (control.activeFocus) { // QTBUG-75862 && mySpinBox.focusReason === Qt.TabFocusReason)
|
||||||
control.preFocusText = spinBoxInput.text
|
control.preFocusText = spinBoxInput.text
|
||||||
spinBoxInput.selectAll()
|
spinBoxInput.selectAll()
|
||||||
|
} else {
|
||||||
|
// Make sure displayed value is correct after focus loss, as onEditingFinished
|
||||||
|
// doesn't trigger when value is something validator doesn't accept.
|
||||||
|
if (spinBoxInput.text === "")
|
||||||
|
spinBoxInput.text = control.textFromValue(control.realValue, control.locale)
|
||||||
|
|
||||||
|
if (control.dirty)
|
||||||
|
spinBoxInput.handleEditingFinished()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user