diff --git a/src/plugins/coreplugin/actionmanager/command.cpp b/src/plugins/coreplugin/actionmanager/command.cpp index 653009203b7..4c7b2c3f303 100644 --- a/src/plugins/coreplugin/actionmanager/command.cpp +++ b/src/plugins/coreplugin/actionmanager/command.cpp @@ -37,6 +37,7 @@ #include #include +#include /*! \class Core::Command @@ -424,8 +425,11 @@ QKeySequence Action::keySequence() const OverrideableAction::OverrideableAction(int id) : Action(id), m_currentAction(0), m_active(false), - m_contextInitialized(false) + m_contextInitialized(false), + m_dummyShortcutEater(this) { + Core::ICore::instance()->mainWindow()->addAction(&m_dummyShortcutEater); + m_dummyShortcutEater.setEnabled(false); } void OverrideableAction::setAction(QAction *action) @@ -465,9 +469,11 @@ bool OverrideableAction::setCurrentContext(const QList &context) m_active = true; return true; } + // no active/delegate action, "visible" action is not enabled/visible if (hasAttribute(CA_Hide)) m_action->setVisible(false); m_action->setEnabled(false); + m_dummyShortcutEater.setEnabled(false); m_active = false; return false; } @@ -521,6 +527,9 @@ void OverrideableAction::actionChanged() m_action->setEnabled(m_currentAction->isEnabled()); m_action->setVisible(m_currentAction->isVisible()); + + m_dummyShortcutEater.setShortcuts(m_action->shortcuts()); + m_dummyShortcutEater.setEnabled(!m_action->isEnabled()); } bool OverrideableAction::isActive() const diff --git a/src/plugins/coreplugin/actionmanager/command_p.h b/src/plugins/coreplugin/actionmanager/command_p.h index 176866dfeeb..1c89fd7b7fb 100644 --- a/src/plugins/coreplugin/actionmanager/command_p.h +++ b/src/plugins/coreplugin/actionmanager/command_p.h @@ -153,6 +153,7 @@ private: QMap > m_contextActionMap; bool m_active; bool m_contextInitialized; + QAction m_dummyShortcutEater; }; } // namespace Internal