qt5base-lts/tests/manual/cocoa/menurama
Gabriel de Dietrich e8a41ed866 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>
2016-11-16 14:23:49 +00:00
..
main.cpp Cocoa Menus: Introducing Menurama manual test 2016-08-19 03:04:28 +00:00
mainwindow.cpp QCocoaMenu: Force NSMenuValidation when syncing items 2016-11-16 14:23:49 +00:00
mainwindow.h Cocoa Menus: Introducing Menurama manual test 2016-08-19 03:04:28 +00:00
mainwindow.ui QCocoaMenu: Force NSMenuValidation when syncing items 2016-11-16 14:23:49 +00:00
menurama.pro Cocoa Menus: Introducing Menurama manual test 2016-08-19 03:04:28 +00:00
menuramaapplication.cpp QCocoaMenu: Force NSMenuValidation when syncing items 2016-11-16 14:23:49 +00:00
menuramaapplication.h QCocoaMenu: Force NSMenuValidation when syncing items 2016-11-16 14:23:49 +00:00