forked from qt-creator/qt-creator
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 <amr.elsayed@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user