forked from qt-creator/qt-creator
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>
This commit is contained in:
committed by
Thomas Hartmann
parent
ea20e6c0a8
commit
d235a6d807
@@ -53,6 +53,8 @@ Rectangle {
|
|||||||
|
|
||||||
property string typeFilter: "QtQuick3D.Material"
|
property string typeFilter: "QtQuick3D.Material"
|
||||||
|
|
||||||
|
property int activatedReason: ComboBox.ActivatedReason.Other
|
||||||
|
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
border.color: StudioTheme.Values.themeControlOutline
|
border.color: StudioTheme.Values.themeControlOutline
|
||||||
border.width: StudioTheme.Values.border
|
border.width: StudioTheme.Values.border
|
||||||
@@ -89,11 +91,13 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onCompressedActivated: {
|
onCompressedActivated: {
|
||||||
|
editableListView.activatedReason = reason
|
||||||
|
|
||||||
if (itemFilterComboBox.empty && itemFilterComboBox.editText !== "") {
|
if (itemFilterComboBox.empty && itemFilterComboBox.editText !== "") {
|
||||||
myRepeater.dirty = false
|
myRepeater.dirty = false
|
||||||
editableListView.add(itemFilterComboBox.editText)
|
editableListView.add(itemFilterComboBox.editText)
|
||||||
} else {
|
} else {
|
||||||
editableListView.replace(myIndex, itemFilterComboBox.editText)
|
editableListView.replace(itemFilterComboBox.myIndex, itemFilterComboBox.editText)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -156,6 +160,9 @@ Rectangle {
|
|||||||
myColumn.currentIndex = lastIndex
|
myColumn.currentIndex = lastIndex
|
||||||
else
|
else
|
||||||
myColumn.currentIndex = myRepeater.localModel.length - 1
|
myColumn.currentIndex = myRepeater.localModel.length - 1
|
||||||
|
|
||||||
|
if (editableListView.activatedReason === ComboBox.ActivatedReason.Other)
|
||||||
|
myColumn.currentItem.forceActiveFocus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -46,7 +46,9 @@ T.ComboBox {
|
|||||||
|
|
||||||
property alias textInput: comboBoxInput
|
property alias textInput: comboBoxInput
|
||||||
|
|
||||||
signal compressedActivated(int index)
|
signal compressedActivated(int index, int reason)
|
||||||
|
|
||||||
|
enum ActivatedReason { EditingFinished, Other }
|
||||||
|
|
||||||
width: StudioTheme.Values.squareComponentWidth * 5
|
width: StudioTheme.Values.squareComponentWidth * 5
|
||||||
height: StudioTheme.Values.height
|
height: StudioTheme.Values.height
|
||||||
@@ -81,7 +83,8 @@ T.ComboBox {
|
|||||||
if (myComboBox.dirty) {
|
if (myComboBox.dirty) {
|
||||||
myTimer.stop()
|
myTimer.stop()
|
||||||
myComboBox.dirty = false
|
myComboBox.dirty = false
|
||||||
myComboBox.compressedActivated(myComboBox.find(myComboBox.editText))
|
myComboBox.compressedActivated(myComboBox.find(myComboBox.editText),
|
||||||
|
ComboBox.ActivatedReason.EditingFinished)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onTextEdited: myComboBox.dirty = true
|
onTextEdited: myComboBox.dirty = true
|
||||||
@@ -114,7 +117,8 @@ T.ComboBox {
|
|||||||
repeat: false
|
repeat: false
|
||||||
running: false
|
running: false
|
||||||
interval: 100
|
interval: 100
|
||||||
onTriggered: myComboBox.compressedActivated(myTimer.activatedIndex)
|
onTriggered: myComboBox.compressedActivated(myTimer.activatedIndex,
|
||||||
|
ComboBox.ActivatedReason.Other)
|
||||||
}
|
}
|
||||||
|
|
||||||
onActivated: {
|
onActivated: {
|
||||||
|
Reference in New Issue
Block a user