Mac: Build menu stays disabled with Qt 4.8.1 and later

Works around QTBUG-25544

Change-Id: I136aaa403f78e9c3903abc013c3267bc3585f54b
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
Eike Ziller
2012-05-02 09:01:06 +02:00
parent 96d42bcd73
commit 359b0a092b

View File

@@ -402,11 +402,27 @@ void MenuActionContainer::removeMenu(QMenu *menu)
m_menu->removeAction(menu->menuAction()); m_menu->removeAction(menu->menuAction());
} }
static bool menuInMenuBar(const QMenu *menu)
{
foreach (const QWidget *widget, menu->menuAction()->associatedWidgets()) {
if (qobject_cast<const QMenuBar *>(widget))
return true;
}
return false;
}
bool MenuActionContainer::updateInternal() bool MenuActionContainer::updateInternal()
{ {
if (onAllDisabledBehavior() == Show) if (onAllDisabledBehavior() == Show)
return true; return true;
#ifdef Q_OS_MAC
// work around QTBUG-25544 which makes menus in the menu bar stay at their enabled state at startup
// (so menus that are disabled at startup would stay disabled)
if (menuInMenuBar(m_menu))
return true;
#endif
bool hasitems = false; bool hasitems = false;
QList<QAction *> actions = m_menu->actions(); QList<QAction *> actions = m_menu->actions();