summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2020-12-01 15:16:34 +0100
committerAndy Shaw <andy.shaw@qt.io>2021-01-29 11:55:43 +0100
commit115bcdb862ec52ebda04e1337f978096d8879e6d (patch)
tree359565249e19aa2e808ff80841c7e36db7aa82d4 /src/plugins/platforms/cocoa
parent8f9222db3b5976ac0977b9ed5f27744c24bd982e (diff)
Cocoa: When validating menus, account for modal window only if active
When a modal window is WindowModal then it is possible for another top level window to be active and therefore the menus shown may be valid for the window. So we can still allow the menu items to be validated in the context of that window. Fixes: QTBUG-74088 Pick-to: 6.0 5.15 Change-Id: Ifb9c3fe12654b2972e0e3c368dc093fae1ed4cc8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r--src/plugins/platforms/cocoa/qnsview_menus.mm7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview_menus.mm b/src/plugins/platforms/cocoa/qnsview_menus.mm
index 7ae274ab04..7e9654b62f 100644
--- a/src/plugins/platforms/cocoa/qnsview_menus.mm
+++ b/src/plugins/platforms/cocoa/qnsview_menus.mm
@@ -73,9 +73,9 @@ static bool selectorIsCutCopyPaste(SEL selector)
if (platformItem->menu())
return YES;
- // Check if a modal dialog is active. Validate only menu
- // items belonging to this view's window own menu bar.
- if (QGuiApplication::modalWindow()) {
+ // Check if a modal dialog is active. If so, enable only menu
+ // items explicitly belonging to this window's own menu bar.
+ if (QGuiApplication::modalWindow() && QGuiApplication::modalWindow()->isActive()) {
QCocoaMenuBar *menubar = nullptr;
QObject *menuParent = platformItem->menuParent();
@@ -84,7 +84,6 @@ static bool selectorIsCutCopyPaste(SEL selector)
menuParent = menuObject->menuParent();
}
- // we have no menubar parent for the application menu items, e.g About and Preferences
if (!menubar || menubar->cocoaWindow() != self.platformWindow)
return NO;
}