QmlDesigner: Close CustomComboBox's popup on view scroll

Also remove the taskbar window (on Windows) that appears when the popup
appears, and make the FlagsComboBox buttons smaller

Fixes: QDS-12215
Change-Id: Ief8ab3b746a3d18b391b46a391cb53e775ecd624
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
Mahmoud Badri
2024-03-12 14:19:05 +02:00
parent 1e92dd4fe4
commit eebd3472ae
3 changed files with 14 additions and 5 deletions

View File

@@ -73,6 +73,7 @@ StudioControls.CustomComboBox {
HelperWidgets.Button { HelperWidgets.Button {
text: qsTr("Select All") text: qsTr("Select All")
width: 80
onClicked: { onClicked: {
let allFlags = 0 let allFlags = 0
@@ -84,6 +85,7 @@ StudioControls.CustomComboBox {
} }
HelperWidgets.Button { HelperWidgets.Button {
text: qsTr("Select None") text: qsTr("Select None")
width: 80
onClicked: root.backendValue.value = 0 onClicked: root.backendValue.value = 0
} }

View File

@@ -17,6 +17,7 @@ Rectangle {
Component.onCompleted: Controller.mainScrollView = mainScrollView Component.onCompleted: Controller.mainScrollView = mainScrollView
default property alias content: mainColumn.children default property alias content: mainColumn.children
property alias scrollView: mainScrollView
// Called from C++ to close context menu on focus out // Called from C++ to close context menu on focus out
function closeContextMenu() { function closeContextMenu() {

View File

@@ -12,8 +12,6 @@ StudioControls.ComboBox {
required property Component popupComponent required property Component popupComponent
required property Item mainRoot
readonly property int popupHeight: Math.min(800, popupLoader.height + 2) readonly property int popupHeight: Math.min(800, popupLoader.height + 2)
property alias popupItem: popupLoader.item property alias popupItem: popupLoader.item
@@ -23,8 +21,8 @@ StudioControls.ComboBox {
popup.height: 0 popup.height: 0
function calculateWindowGeometry() { function calculateWindowGeometry() {
let gPos = globalPos(mainRoot.mapFromItem(root, 0, 0)) let gPos = globalPos(itemPane.mapFromItem(root, 0, 0))
let scrRect = screenRect(); let scrRect = screenRect()
window.width = Math.max(root.width - root.actionIndicator.width, popupLoader.width + 2) // 2: scrollView left and right 1px margins window.width = Math.max(root.width - root.actionIndicator.width, popupLoader.width + 2) // 2: scrollView left and right 1px margins
@@ -70,10 +68,18 @@ StudioControls.ComboBox {
} }
} }
Connections {
target: itemPane.scrollView
function onContentYChanged() {
window.hide() // TODO: a better solution is to move the window instead of hiding
}
}
Window { Window {
id: window id: window
flags: Qt.Dialog | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint flags: Qt.Tool | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint
onActiveFocusItemChanged: { onActiveFocusItemChanged: {
if (!window.activeFocusItem && !root.hovered && root.popup.opened) if (!window.activeFocusItem && !root.hovered && root.popup.opened)