qt5base-lts/tests/manual/cocoa
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
..
appicon Updated license headers 2016-01-21 18:55:18 +00:00
menurama QCocoaMenu: Force NSMenuValidation when syncing items 2016-11-16 14:23:49 +00:00
menus Updated license headers 2016-01-21 18:55:18 +00:00
nativewidgets Updated license headers 2016-01-21 18:55:18 +00:00
popups Updated license headers 2016-01-21 18:55:18 +00:00
qmaccocoaviewcontainer Implement QMacCocoaViewContainer in terms of foreign window 2016-10-05 19:37:17 +00:00
qsystemtrayicon Updated license headers 2016-01-21 18:55:18 +00:00
qt_on_cocoa Updated license headers 2016-01-21 18:55:18 +00:00
wheelevent Updated license headers 2016-01-21 18:55:18 +00:00