summaryrefslogtreecommitdiffstats
path: root/tests/manual/cocoa/menurama/menuramaapplication.h
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@qt.io>2016-11-02 17:37:43 -0700
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2016-11-16 14:23:49 +0000
commite8a41ed8668437eb6ad406ddabf4141fd66a85d2 (patch)
tree0535bca2a94bbae05e0fd819dd9f3c09f081fe2f /tests/manual/cocoa/menurama/menuramaapplication.h
parent3e5e2cd3bd1271ce886fe5b97fe07dffb2631cc6 (diff)
QCocoaMenu: Force NSMenuValidation when syncing items
When a menu item's enabled state changes after -[QCocoaMenuDelegate menuWillOpen:] is invoked, i.e., during or after QMenu::aboutToShow() is emitted, that state change may not be taken into account. This is because the automatic menu validation, upon which Qt relies, is not made aware of any such change. By calling -[NSMenu update] when syncing the QPA menu item, we induce Cocoa to invoke -[QCocoaMenuDelegate validateMenuItem:] and ensure that previously synced items, whose state may have changed, will be properly updated. This, however, has a small side effect, namely that menu-holding items will also go through the automatic menu enabling path and may appear disabled since, until now, they were not properly configured. In order to solve this, we set the action on those items as well, and make sure that both of QCocoaMenuDelegate's relevant methods, validateMenuItem: and itemFired:, properly process menu-holding items. Menurama manual test updated accordingly. Change-Id: I62f955538b8be09b8494ea0ce87fca7910148d38 Task-number: QTBUG-56850 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'tests/manual/cocoa/menurama/menuramaapplication.h')
-rw-r--r--tests/manual/cocoa/menurama/menuramaapplication.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/manual/cocoa/menurama/menuramaapplication.h b/tests/manual/cocoa/menurama/menuramaapplication.h
index 07c8da27a1..b0670cc53b 100644
--- a/tests/manual/cocoa/menurama/menuramaapplication.h
+++ b/tests/manual/cocoa/menurama/menuramaapplication.h
@@ -50,6 +50,7 @@ class MenuramaApplication : public QApplication
public:
MenuramaApplication(int argc, char **argv);
void addDynMenu(QLatin1String title, QMenu *parentMenu);
+ QAction *findAction(QLatin1String title, QMenu *parentMenu);
public slots:
void populateMenu(QMenu *menu, bool clear);