8

I need two shortcuts for one action.

Ctrl+1 or ctrl+s

Is there any way how to do that? Or I have to create copy of the action and than assign second shortcut to this action?

Meloun
  • 13,601
  • 17
  • 64
  • 93
  • 1
    Did you look at `QAction::setShortcuts(const QList & shortcuts)`? – vahancho Apr 30 '14 at 13:07
  • 1
    Write this as an answer please.. I am using qt designer and there is used just method setShortcut. So I have to write a wrapper for this. – Meloun May 01 '14 at 11:43

1 Answers1

13

In order of install multiple shortcuts on an action you can use QAction::setShortcuts(const QList<QKeySequence> & shortcuts) function. For example:

QList<QKeySequence> shortcuts;
shortcuts << QKeySequence("Ctrl+1") << QKeySequence("Ctrl+S");
action->setShortcuts(shortcuts);
vahancho
  • 20,808
  • 3
  • 47
  • 55