QCocoaMenuItem: Don't clear NSMenuItem.action when setting submenu

Contrarily to what the comment stated, we actually rely on automatic
menu validation, even for submenu items. This is visible in the menu
delegate's validateMenuItem: and itemFired: methods.

This solves the last visible issue in BigMenuCreator where, under
ASP/ASP, ASP/SAP, SAP/ASP and SAP/SAP, all A*S submenus would be
disabled. The cause was an incorrect target/action setup.

Menurama still behaves as expected.

Change-Id: I2599d6fb0d51f56f5d36f03b69647e35ff6c550a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Gabriel de Dietrich 2017-10-25 09:32:48 +07:00 committed by Shawn Rutledge
parent 5d6878f234
commit 3f519ffa15

View File

@ -150,10 +150,6 @@ void QCocoaMenuItem::setMenu(QPlatformMenu *menu)
QMacAutoReleasePool pool;
m_menu = static_cast<QCocoaMenu *>(menu);
if (m_menu) {
if (m_native) {
// Skip automatic menu item validation
m_native.action = nil;
}
m_menu->setMenuParent(this);
m_menu->propagateEnabledState(isEnabled());
} else {