summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarek Kobus <jkobus@trolltech.com>2010-01-05 15:14:04 +0100
committerJarek Kobus <jkobus@trolltech.com>2010-01-05 15:24:55 +0100
commit59ecb9cf83313f82af857c7898dc075248d7668e (patch)
tree8eccb048a91cc9d84e02819f9517d55b7f7ad3d6
parenta866725405c65cd333247b6aaa5b82cda8f7e283 (diff)
downloadqt-creator-59ecb9cf83313f82af857c7898dc075248d7668e.tar.gz
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
-rw-r--r--src/plugins/coreplugin/actionmanager/command.cpp12
-rw-r--r--src/plugins/coreplugin/actionmanager/command_p.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/coreplugin/actionmanager/command.cpp b/src/plugins/coreplugin/actionmanager/command.cpp
index 6e84d29c55..b92720f4cd 100644
--- a/src/plugins/coreplugin/actionmanager/command.cpp
+++ b/src/plugins/coreplugin/actionmanager/command.cpp
@@ -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);
+}
diff --git a/src/plugins/coreplugin/actionmanager/command_p.h b/src/plugins/coreplugin/actionmanager/command_p.h
index 176866dfee..accb15e4ac 100644
--- a/src/plugins/coreplugin/actionmanager/command_p.h
+++ b/src/plugins/coreplugin/actionmanager/command_p.h
@@ -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();