QmlDesigner: Fix TopLevelComboBoxes

The combobox will break bindings on current index. Therefore
we cannot use a binding on the instances.

Change-Id: I5b4ede02b8b945429b37efa4fc3e1acc15b3fbe7
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Thomas Hartmann
2023-03-17 14:25:40 +01:00
parent 020d38db1a
commit d61830f91f
3 changed files with 8 additions and 3 deletions

View File

@@ -140,6 +140,7 @@ T.ComboBox {
id: itemDelegate
onClicked: {
control.currentIndex = index
control.activated(index)
comboBoxPopup.close()
}

View File

@@ -77,7 +77,8 @@ Item {
onActivated: backend.setCurrentStyle(styles.currentIndex)
openUpwards: true
enabled: backend.isInDesignMode
currentIndex: backend.currentStyle
property int currentStyleIndex: backend.currentStyle
onCurrentStyleIndexChanged: currentIndex = backend.currentStyle
}
}
}

View File

@@ -137,8 +137,9 @@ Rectangle {
anchors.left: livePreviewButton.right
anchors.leftMargin: 10
model: backend.documentModel
currentIndex: backend.documentIndex
property int currentDocumentIndex: backend.documentIndex
onCurrentDocumentIndexChanged: currentFile.currentIndex = currentFile.currentDocumentIndex
onActivated: backend.openFileByIndex(index)
}
@@ -237,7 +238,9 @@ Rectangle {
anchors.right: annotations.left
anchors.rightMargin: 10
model: backend.workspaces
currentIndex: workspaces.find(backend.currentWorkspace)
property int currentWorkspaceIndex: workspaces.find(backend.currentWorkspace)
onCurrentWorkspaceIndexChanged: workspaces.currentIndex = workspaces.currentWorkspaceIndex
visible: !root.flyoutEnabled
onActivated: backend.setCurrentWorkspace(workspaces.currentText)