forked from qt-creator/qt-creator
Make it possible to set more than one shortcut per action
Multiple shortcuts per action make it possible to configure friendlier behavior. E.g. on macOS decreasing/increasing font sizes, and deleting elements usually have two shortcuts each. But also custom configurations that assign a different key to a common function without removing the default can be useful. In this patch the functionality is still pretty much hidden from the user, even though there is a "secret" way to enter such multiple shortcuts in the settings dialog, by separating shortcuts with " | ". Task-number: QTCREATORBUG-72 Change-Id: I16bec0a71aaf4abf50335b0fd7da620c73b31777 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -58,7 +58,9 @@ public:
|
||||
Q_DECLARE_FLAGS(CommandAttributes, CommandAttribute)
|
||||
|
||||
virtual void setDefaultKeySequence(const QKeySequence &key) = 0;
|
||||
virtual QKeySequence defaultKeySequence() const = 0;
|
||||
virtual void setDefaultKeySequences(const QList<QKeySequence> &keys) = 0;
|
||||
virtual QList<QKeySequence> defaultKeySequences() const = 0;
|
||||
virtual QList<QKeySequence> keySequences() const = 0;
|
||||
virtual QKeySequence keySequence() const = 0;
|
||||
// explicitly set the description (used e.g. in shortcut settings)
|
||||
// default is to use the action text for actions, or the whatsThis for shortcuts,
|
||||
@@ -78,7 +80,7 @@ public:
|
||||
|
||||
virtual bool isActive() const = 0;
|
||||
|
||||
virtual void setKeySequence(const QKeySequence &key) = 0;
|
||||
virtual void setKeySequences(const QList<QKeySequence> &keys) = 0;
|
||||
virtual QString stringWithAppendedShortcut(const QString &str) const = 0;
|
||||
void augmentActionWithShortcutToolTip(QAction *action) const;
|
||||
static QToolButton *toolButtonWithAppendedShortcut(QAction *action, Command *cmd);
|
||||
|
||||
Reference in New Issue
Block a user