diff options
author | Shrief Gabr <shrief.gabr@qt.io> | 2024-02-05 13:56:13 +0200 |
---|---|---|
committer | Shrief Gabr <shrief.gabr@qt.io> | 2024-02-06 19:12:24 +0000 |
commit | e43b0bcc1fb9c25b3f8a2052bae3c93bb19c8fc8 (patch) | |
tree | 9ae85655fea0219a4b0677e81d609df2166e2a4b | |
parent | 3e709802790426130e541d54a27aa8bff007f4e4 (diff) |
QmlDesigner: Fix unchangeable data in cells
* Changes to the cell data are saved if Return or Enter keys are pressed.
Task-number: QDS-11894
Change-Id: Ia3a1ff8f6c9275906736fa1e0638b81c92bea910
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
3 files changed, 40 insertions, 5 deletions
diff --git a/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsEditDelegate.qml b/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsEditDelegate.qml index 6a3146a818..90b3021c96 100644 --- a/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsEditDelegate.qml +++ b/share/qtcreator/qmldesigner/collectionEditorQmlSource/CollectionDetailsEditDelegate.qml @@ -91,6 +91,11 @@ Item { realStepSize: 1.0 decimals: 6 trailingZeroes: false + + onActiveFocusChanged: { + if (realField.activeFocus) + realField.contentItem.focus = true + } } } } @@ -112,6 +117,11 @@ Item { from: -2147483647 to: 2147483647 decimals: 0 + + onActiveFocusChanged: { + if (integerField.activeFocus) + integerField.contentItem.focus = true + } } } } @@ -149,7 +159,7 @@ Item { target: editorPopup.editor function onActiveFocusChanged() { - if (!editorPopup.activeFocus) + if (!editorPopup.editor.activeFocus) editorPopup.close() else if (edit) editorPopup.editor.editValue = edit @@ -163,6 +173,14 @@ Item { editorLoader.changesAccepted = false editorPopup.close() } + + function onReturnPressed() { + editorPopup.close() + } + + function onEnterPressed() { + editorPopup.close() + } } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBox.qml index 37612af13f..4f51d7aa1f 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBox.qml @@ -90,6 +90,11 @@ T.SpinBox { value: 0 to: 99 + function checkAndClearFocus() { + if (!spinBoxIndicatorUp.activeFocus && !spinBoxIndicatorDown.activeFocus && !spinBoxInput.activeFocus) + control.focus = false + } + validator: DoubleValidator { id: doubleValidator locale: control.locale.name @@ -151,7 +156,7 @@ T.SpinBox { validator: doubleValidator function handleEditingFinished() { - control.focus = false + control.checkAndClearFocus() // Keep the dirty state before calling setValueFromInput(), // it will be set to false (cleared) internally @@ -165,7 +170,11 @@ T.SpinBox { control.compressedRealValueModified() } - onEditingFinished: spinBoxInput.handleEditingFinished() + onEditingFinished: { + spinBoxInput.focus = false + spinBoxInput.handleEditingFinished() + } + onTextEdited: control.dirty = true } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/SpinBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/SpinBox.qml index da2a7f1d5d..ffde6e4ad1 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/SpinBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/SpinBox.qml @@ -69,6 +69,11 @@ T.SpinBox { editable: true validator: control.decimals ? doubleValidator : intValidator + function checkAndClearFocus() { + if (!spinBoxIndicatorUp.activeFocus && !spinBoxIndicatorDown.activeFocus && !spinBoxInput.activeFocus) + control.focus = false + } + DoubleValidator { id: doubleValidator locale: control.locale.name @@ -132,7 +137,7 @@ T.SpinBox { __parentControl: control function handleEditingFinished() { - control.focus = false + control.checkAndClearFocus() // Keep the dirty state before calling setValueFromInput(), // it will be set to false (cleared) internally @@ -146,7 +151,10 @@ T.SpinBox { control.compressedValueModified() } - onEditingFinished: spinBoxInput.handleEditingFinished() + onEditingFinished: { + spinBoxInput.focus = false + spinBoxInput.handleEditingFinished() + } } background: Rectangle { |