diff --git a/src/plugins/coreplugin/actionmanager/command.cpp b/src/plugins/coreplugin/actionmanager/command.cpp index 592ba08faac..ab78bf50892 100644 --- a/src/plugins/coreplugin/actionmanager/command.cpp +++ b/src/plugins/coreplugin/actionmanager/command.cpp @@ -289,6 +289,15 @@ QAction *Command::action() const return d->m_action; } +QAction *Command::actionForContext(const Utils::Id &contextId) const +{ + auto it = d->m_contextActionMap.find(contextId); + if (it == d->m_contextActionMap.end()) + return nullptr; + + return *it; +} + QString Command::stringWithAppendedShortcut(const QString &str) const { return Utils::ProxyAction::stringWithAppendedShortcut(str, keySequence()); diff --git a/src/plugins/coreplugin/actionmanager/command.h b/src/plugins/coreplugin/actionmanager/command.h index b900a50f55a..73dd92a5eb8 100644 --- a/src/plugins/coreplugin/actionmanager/command.h +++ b/src/plugins/coreplugin/actionmanager/command.h @@ -57,6 +57,8 @@ public: Utils::Id id() const; QAction *action() const; + QAction *actionForContext(const Utils::Id &contextId) const; + Context context() const; void setAttribute(CommandAttribute attr);