Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two shortcuts for one action

Tags:

qt

pyqt

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?

like image 569
Meloun Avatar asked Apr 30 '14 12:04

Meloun


1 Answers

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);
like image 83
vahancho Avatar answered Oct 14 '22 04:10

vahancho