From e255716291183ac374a14314f7acf07cbb681223 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 1 Dec 2020 15:16:34 +0100 Subject: Cocoa: When validating menus, account for modal window only if active MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø (cherry picked from commit 115bcdb862ec52ebda04e1337f978096d8879e6d) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/cocoa/qnsview_menus.mm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/plugins/platforms') 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; } -- cgit v1.2.3