diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ComboBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ComboBox.qml index 006bb9037ca..cbd82028cfd 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ComboBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ComboBox.qml @@ -131,23 +131,23 @@ T.ComboBox { delegate: ItemDelegate { id: itemDelegate + required property var model + required property int index + width: comboBoxPopup.width - comboBoxPopup.leftPadding - comboBoxPopup.rightPadding height: control.style.controlSize.height - 2 * control.style.borderWidth padding: 0 - enabled: model.enabled === undefined ? true : model.enabled + enabled: itemDelegate.model["enabled"] === undefined ? true : itemDelegate.model["enabled"] contentItem: Text { leftPadding: 8 rightPadding: verticalScrollBar.style.scrollBarThicknessHover - text: control.textRole ? (Array.isArray(control.model) - ? modelData[control.textRole] - : model[control.textRole]) - : modelData + text: itemDelegate.model[control.textRole] color: { if (!itemDelegate.enabled) return control.style.text.disabled - if (control.currentIndex === index) + if (control.currentIndex === itemDelegate.index) return control.style.text.selectedText return control.style.text.idle @@ -158,10 +158,7 @@ T.ComboBox { ToolTipArea { anchors.fill: parent - text: control.tooltipRole ? (Array.isArray(control.model) - ? modelData[control.tooltipRole] - : model[control.tooltipRole]) - : "" + text: control.tooltipRole ? itemDelegate.model[control.tooltipRole] : "" enabled: text onClicked: itemDelegate.clicked() onDoubleClicked: itemDelegate.doubleClicked() diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/TopLevelComboBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/TopLevelComboBox.qml index 284e32a7b25..3ee49b56ad8 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/TopLevelComboBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/TopLevelComboBox.qml @@ -156,6 +156,9 @@ T.ComboBox { delegate: ItemDelegate { id: itemDelegate + required property var model + required property int index + onClicked: { // Necessary to keep the transient parent open otherwise it will change the focus // to the main window "Utils::AppMainWindowClassWindow" and closes the transient @@ -169,15 +172,12 @@ T.ComboBox { width: control.width height: control.style.controlSize.height padding: 0 - enabled: model.enabled === undefined ? true : model.enabled + enabled: itemDelegate.model["enabled"] === undefined ? true : itemDelegate.model["enabled"] contentItem: Text { leftPadding: 8 rightPadding: verticalScrollBar.style.scrollBarThicknessHover - text: control.textRole ? (Array.isArray(control.model) - ? modelData[control.textRole] - : model[control.textRole]) - : modelData + text: itemDelegate.model[control.textRole] color: { if (!itemDelegate.enabled) return control.style.text.disabled