aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Gruendl <henning.gruendl@qt.io>2019-08-30 17:17:08 +0200
committerThomas Hartmann <thomas.hartmann@qt.io>2019-09-02 07:36:36 +0000
commit9af2563a69cf713fe68e51cfdf6a10287e58f662 (patch)
tree6ae1738f9780a909a1c56c684f803918d99c4d41
parent330126af1e69190628c7c4e90b2386fc82db7fcb (diff)
QmlDesigner: Fix SpinBox DragHandler issue
Fixes an issue of the RealSpinBox DragHandler where the value compression timer, which is responsible to trigger a write to the backend, wasn't triggered anymore, because the SpinBox had no focus after ending the drag operation. Change-Id: Ibdf02856c96b997db20c3019438f9645fa853e75 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBox.qml2
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBoxInput.qml13
2 files changed, 10 insertions, 5 deletions
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBox.qml
index 3f0d1296e5..39cd51d288 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBox.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBox.qml
@@ -71,6 +71,8 @@ T.SpinBox {
property real __sliderIndicatorWidth: StudioTheme.Values.squareComponentWidth
property real __sliderIndicatorHeight: StudioTheme.Values.height
+ property alias compressedValueTimer: myTimer
+
signal realValueModified
signal compressedRealValueModified
signal dragStarted
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBoxInput.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBoxInput.qml
index 7de0eb735e..243859e2d8 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBoxInput.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBoxInput.qml
@@ -88,6 +88,10 @@ TextInput {
// Force focus on the non visible component to receive key events
dragModifierWorkaround.forceActiveFocus()
} else {
+ if (myControl.compressedValueTimer.running) {
+ myControl.compressedValueTimer.stop()
+ calcValue(myControl.compressedRealValueModified)
+ }
mouseArea.cursorShape = Qt.PointingHandCursor // TODO
myControl.drag = false
myControl.dragEnded()
@@ -97,15 +101,14 @@ TextInput {
myControl.focus = false
}
}
- onTranslationChanged: calcValue()
- onMultiplierChanged: calcValue()
+ onTranslationChanged: calcValue(myControl.realValueModified)
+ onMultiplierChanged: calcValue(myControl.realValueModified)
- function calcValue() {
+ function calcValue(callback) {
var tmp = myControl.realDragRange / StudioTheme.Values.dragLength
var currValue = myControl.realValue
myControl.setRealValue(dragHandler.initialValue + (tmp * dragHandler.translation.x * dragHandler.multiplier))
- if (currValue !== myControl.realValue)
- myControl.realValueModified()
+ callback()
}
}