forked from qt-creator/qt-creator
Changing the command's shortcut updates its internal actions.
If the command's shortcut is changed all context actions are updated accordingly. When the new context action is added its shortcut is automatically updated (taken from command's shortcut). Reviewed-by: con Task-number: QTCREATORBUG-471
This commit is contained in:
@@ -500,6 +500,7 @@ void OverrideableAction::addOverrideAction(QAction *action, const QList<int> &co
|
||||
m_contextActionMap.insert(k, action);
|
||||
}
|
||||
}
|
||||
action->setShortcut(OverrideableAction::action()->shortcut());
|
||||
}
|
||||
|
||||
void OverrideableAction::actionChanged()
|
||||
@@ -529,3 +530,14 @@ bool OverrideableAction::isActive() const
|
||||
{
|
||||
return m_active;
|
||||
}
|
||||
|
||||
void OverrideableAction::setKeySequence(const QKeySequence &key)
|
||||
{
|
||||
QMap<int, QPointer<QAction> >::const_iterator it = m_contextActionMap.constBegin();
|
||||
QMap<int, QPointer<QAction> >::const_iterator itEnd = m_contextActionMap.constEnd();
|
||||
while (it != itEnd) {
|
||||
it.value()->setShortcut(key);
|
||||
++it;
|
||||
}
|
||||
Action::setKeySequence(key);
|
||||
}
|
||||
|
@@ -143,6 +143,7 @@ public:
|
||||
bool setCurrentContext(const QList<int> &context);
|
||||
void addOverrideAction(QAction *action, const QList<int> &context);
|
||||
bool isActive() const;
|
||||
void setKeySequence(const QKeySequence &key);
|
||||
|
||||
private slots:
|
||||
void actionChanged();
|
||||
|
Reference in New Issue
Block a user