From d61830f91f5a6060ab5eaa73e77a2fa9d7e0db35 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 17 Mar 2023 14:25:40 +0100 Subject: [PATCH] QmlDesigner: Fix TopLevelComboBoxes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Thomas Hartmann --- .../imports/StudioControls/TopLevelComboBox.qml | 1 + share/qtcreator/qmldesigner/statusbar/Main.qml | 3 ++- share/qtcreator/qmldesigner/toolbar/Main.qml | 7 +++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/TopLevelComboBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/TopLevelComboBox.qml index 9c200a23972..dd13ba586b7 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/TopLevelComboBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/TopLevelComboBox.qml @@ -140,6 +140,7 @@ T.ComboBox { id: itemDelegate onClicked: { + control.currentIndex = index control.activated(index) comboBoxPopup.close() } diff --git a/share/qtcreator/qmldesigner/statusbar/Main.qml b/share/qtcreator/qmldesigner/statusbar/Main.qml index 1310da45f63..db1a125e10f 100644 --- a/share/qtcreator/qmldesigner/statusbar/Main.qml +++ b/share/qtcreator/qmldesigner/statusbar/Main.qml @@ -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 } } } diff --git a/share/qtcreator/qmldesigner/toolbar/Main.qml b/share/qtcreator/qmldesigner/toolbar/Main.qml index 8579c21a0b6..69d85073b1b 100644 --- a/share/qtcreator/qmldesigner/toolbar/Main.qml +++ b/share/qtcreator/qmldesigner/toolbar/Main.qml @@ -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)