From 9d0fd52a7ccce6f37b9b107a38b55d4a456f3d4f Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 20 Nov 2023 16:35:35 +0200 Subject: [PATCH] EffectMaker: Fix combo box open/close behavior Fixed inconsistent opening and closing of preview and add effect popups, when clicking on the content part of the combo box. Also, pressing Escape now closes opened combobox popups. Fixes: QDS-11307 Change-Id: I3b3fddbaa743c77fd60833378ab809b17a8f1a84 Reviewed-by: Amr Elsayed Reviewed-by: Mahmoud Badri --- .../EffectNodesComboBox.qml | 8 ++++++- .../PreviewImagesComboBox.qml | 22 ++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/share/qtcreator/qmldesigner/effectMakerQmlSources/EffectNodesComboBox.qml b/share/qtcreator/qmldesigner/effectMakerQmlSources/EffectNodesComboBox.qml index 0aca7a89089..42265970787 100644 --- a/share/qtcreator/qmldesigner/effectMakerQmlSources/EffectNodesComboBox.qml +++ b/share/qtcreator/qmldesigner/effectMakerQmlSources/EffectNodesComboBox.qml @@ -78,7 +78,7 @@ StudioControls.ComboBox { flags: Qt.Dialog | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint onActiveFocusItemChanged: { - if (!window.activeFocusItem && !root.indicator.hover && root.popup.opened) + if (!window.activeFocusItem && !root.hovered && root.popup.opened) root.popup.close() } @@ -87,6 +87,7 @@ StudioControls.ComboBox { color: StudioTheme.Values.themePanelBackground border.color: StudioTheme.Values.themeInteraction border.width: 1 + focus: true HelperWidgets.ScrollView { anchors.fill: parent @@ -126,6 +127,11 @@ StudioControls.ComboBox { } } } + + Keys.onPressed: function(event) { + if (event.key === Qt.Key_Escape && root.popup.opened) + root.popup.close() + } } } } diff --git a/share/qtcreator/qmldesigner/effectMakerQmlSources/PreviewImagesComboBox.qml b/share/qtcreator/qmldesigner/effectMakerQmlSources/PreviewImagesComboBox.qml index 02e43ea10c7..feadaa1d940 100644 --- a/share/qtcreator/qmldesigner/effectMakerQmlSources/PreviewImagesComboBox.qml +++ b/share/qtcreator/qmldesigner/effectMakerQmlSources/PreviewImagesComboBox.qml @@ -90,6 +90,20 @@ StudioControls.ComboBox { anchors.fill: parent anchors.margins: 1 } + + MouseArea { + anchors.fill: parent + enabled: true + acceptedButtons: Qt.LeftButton + cursorShape: Qt.PointingHandCursor + onPressed: (mouse) => { + if (root.popup.opened) + root.popup.close() + else + root.popup.open() + mouse.accepted = true + } + } } Window { @@ -98,7 +112,7 @@ StudioControls.ComboBox { flags: Qt.Dialog | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint onActiveFocusItemChanged: { - if (!window.activeFocusItem && !root.indicator.hover && root.popup.opened) + if (!window.activeFocusItem && !root.hovered && root.popup.opened) root.popup.close() } @@ -107,6 +121,7 @@ StudioControls.ComboBox { color: StudioTheme.Values.themePanelBackground border.color: StudioTheme.Values.themeInteraction border.width: 1 + focus: true HelperWidgets.ScrollView { anchors.fill: parent @@ -153,6 +168,11 @@ StudioControls.ComboBox { } } } + + Keys.onPressed: function(event) { + if (event.key === Qt.Key_Escape && root.popup.opened) + root.popup.close() + } } } }