Commit 40623d00 authored by con's avatar con
Browse files

Handle action containers with custom QActions more gracefully.

Related to QTCREATORBUG-1764.
parent 66e01e88
......@@ -390,8 +390,10 @@ bool MenuActionContainer::updateInternal()
return true;
bool hasitems = false;
QList<QAction *> actions = m_menu->actions();
foreach (ActionContainer *container, subContainers()) {
actions.removeAll(container->menu()->menuAction());
if (container == this) {
qWarning() << Q_FUNC_INFO << "container" << (this->menu() ? this->menu()->title() : "") << "contains itself as subcontainer";
continue;
......@@ -403,12 +405,22 @@ bool MenuActionContainer::updateInternal()
}
if (!hasitems) {
foreach (Command *command, commands()) {
actions.removeAll(command->action());
if (command->isActive()) {
hasitems = true;
break;
}
}
}
if (!hasitems) {
// look if there were actions added that we don't control and check if they are enabled
foreach (const QAction *action, actions) {
if (!action->isSeparator() && action->isEnabled()) {
hasitems = true;
break;
}
}
}
if (hasEmptyAction(EA_Hide))
m_menu->setVisible(hasitems);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment