diff options
author | Henning Gruendl <henning.gruendl@qt.io> | 2020-08-20 16:38:05 +0200 |
---|---|---|
committer | Thomas Hartmann <thomas.hartmann@qt.io> | 2020-08-27 10:05:04 +0000 |
commit | d235a6d80728d605fc745f0a45d700b8ac3ba8c7 (patch) | |
tree | a8327bfe5499e88371a9e3129527ad852ddeed64 /share | |
parent | ea20e6c0a8d9cf18e5546fceaf353ee08a65c4e1 (diff) |
QmlDesigner: Fix focus on EditableListView
* Add an enum to the StudioControls ComboBox to indicate type of
interaction
* Force focus on last used ComboBox if activated signal wasn't send
due to editing of the ComboBoxInput
Task-number: QDS-2626
Change-Id: I20b1660a05923baacef30f91080642baacee0378
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'share')
2 files changed, 15 insertions, 4 deletions
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/EditableListView.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/EditableListView.qml index c3344fcfe0..7fc3c9f3f2 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/EditableListView.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/EditableListView.qml @@ -53,6 +53,8 @@ Rectangle { property string typeFilter: "QtQuick3D.Material" + property int activatedReason: ComboBox.ActivatedReason.Other + color: "transparent" border.color: StudioTheme.Values.themeControlOutline border.width: StudioTheme.Values.border @@ -89,11 +91,13 @@ Rectangle { } onCompressedActivated: { + editableListView.activatedReason = reason + if (itemFilterComboBox.empty && itemFilterComboBox.editText !== "") { myRepeater.dirty = false editableListView.add(itemFilterComboBox.editText) } else { - editableListView.replace(myIndex, itemFilterComboBox.editText) + editableListView.replace(itemFilterComboBox.myIndex, itemFilterComboBox.editText) } } } @@ -156,6 +160,9 @@ Rectangle { myColumn.currentIndex = lastIndex else myColumn.currentIndex = myRepeater.localModel.length - 1 + + if (editableListView.activatedReason === ComboBox.ActivatedReason.Other) + myColumn.currentItem.forceActiveFocus() } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ComboBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ComboBox.qml index 1c3dc46c15..449a40432a 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ComboBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ComboBox.qml @@ -46,7 +46,9 @@ T.ComboBox { property alias textInput: comboBoxInput - signal compressedActivated(int index) + signal compressedActivated(int index, int reason) + + enum ActivatedReason { EditingFinished, Other } width: StudioTheme.Values.squareComponentWidth * 5 height: StudioTheme.Values.height @@ -81,7 +83,8 @@ T.ComboBox { if (myComboBox.dirty) { myTimer.stop() myComboBox.dirty = false - myComboBox.compressedActivated(myComboBox.find(myComboBox.editText)) + myComboBox.compressedActivated(myComboBox.find(myComboBox.editText), + ComboBox.ActivatedReason.EditingFinished) } } onTextEdited: myComboBox.dirty = true @@ -114,7 +117,8 @@ T.ComboBox { repeat: false running: false interval: 100 - onTriggered: myComboBox.compressedActivated(myTimer.activatedIndex) + onTriggered: myComboBox.compressedActivated(myTimer.activatedIndex, + ComboBox.ActivatedReason.Other) } onActivated: { |