From c476a1b807b25cc4a0529f59f3e13dabb0036e7b Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 12 Dec 2022 15:43:54 +0200 Subject: [PATCH] QmlDesigner: Intercept stray mouse events on popup menus By default Qt Quick Controls Menu lets mouse events through to the underlying view if the event is not handled by the menu item. This is the case for all clicks on disabled items and right clicks on enabled items. To prevent unwanted click-throughs, added a mouse area to the background of StudioControls.Menu that eats all clicks. Fixes: QDS-8584 Change-Id: I08fa93317ffcaf518b350d44bb555d84741e246d Reviewed-by: Thomas Hartmann Reviewed-by: Mahmoud Badri Reviewed-by: --- .../imports/StudioControls/Menu.qml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/Menu.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/Menu.qml index 306d4aeda98..d0fb8719ad1 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/Menu.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/Menu.qml @@ -40,5 +40,13 @@ T.Menu { color: StudioTheme.Values.themeControlBackground border.color: StudioTheme.Values.themeControlOutline border.width: StudioTheme.Values.border + MouseArea { + // This mouse area is here to eat clicks that are not handled by menu items + // to prevent them going through to the underlying view. + // This is primarily problem with disabled menu items, but right clicks would go + // through enabled menu items as well. + anchors.fill: parent + acceptedButtons: Qt.AllButtons + } } }