一个动作我需要两个快捷方式.
Ctrl+1 or ctrl+s
有什么方法可以做到吗?或者我必须创建操作的副本,然后为此操作分配第二个快捷方式?
为了在动作上安装多个快捷方式,您可以使用QAction::setShortcuts(const QList<QKeySequence> & shortcuts)功能.例如:
QList<QKeySequence> shortcuts;
shortcuts << QKeySequence("Ctrl+1") << QKeySequence("Ctrl+S");
action->setShortcuts(shortcuts);