summaryrefslogtreecommitdiff
path: root/src/plugins/coreplugin
diff options
context:
space:
mode:
authorcon <qtc-committer@nokia.com>2010-06-28 17:28:10 +0200
committercon <qtc-committer@nokia.com>2010-06-28 17:28:10 +0200
commit40623d008d1d0a5e2b88af141ab51d8b9e669a67 (patch)
treec132cde71ce849f214f2682beadc1018d6f6988b /src/plugins/coreplugin
parent66e01e881d7cb865338a6a7949f9a085883387c9 (diff)
downloadqt-creator-40623d008d1d0a5e2b88af141ab51d8b9e669a67.tar.gz
Handle action containers with custom QActions more gracefully.
Related to QTCREATORBUG-1764.
Diffstat (limited to 'src/plugins/coreplugin')
-rw-r--r--src/plugins/coreplugin/actionmanager/actioncontainer.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/plugins/coreplugin/actionmanager/actioncontainer.cpp b/src/plugins/coreplugin/actionmanager/actioncontainer.cpp
index aa8ff2c7ed..01f5458946 100644
--- a/src/plugins/coreplugin/actionmanager/actioncontainer.cpp
+++ b/src/plugins/coreplugin/actionmanager/actioncontainer.cpp
@@ -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);