سؤال

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?

هل كانت مفيدة؟

المحلول

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);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top