summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2020-12-01 15:16:34 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-01-29 14:53:25 +0000
commite255716291183ac374a14314f7acf07cbb681223 (patch)
tree9910cbd5c56386c1a623c8348c4698620d103a66 /src/plugins/platforms
parentb61275ee72ae2a895dee3652aca886859962cdb2 (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 Change-Id: Ifb9c3fe12654b2972e0e3c368dc093fae1ed4cc8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 115bcdb862ec52ebda04e1337f978096d8879e6d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/plugins/platforms')
-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;
}