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:
Jarek Kobus
2010-01-05 15:14:04 +01:00
parent a866725405
commit 59ecb9cf83
2 changed files with 13 additions and 0 deletions

View File

@@ -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);
}

View File

@@ -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();