forked from qt-creator/qt-creator
Core: Add Command::actionForContext
Change-Id: I04ea463e1e9f4addafbea78c6302a488d7992ccd Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user