forked from qt-creator/qt-creator
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:
@@ -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();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user