福州司马懿 2016-08-25 01:40 采纳率: 0%
浏览 3732

Qt 右键菜单快捷键无效

//菜单设置快捷键无效
action3->setShortcutContext(Qt::WidgetShortcut);
action3->setShortcut(QKeySequence(Qt::ALT | Qt::Key_G));
connect(action3, SIGNAL(triggered()), this, SLOT(onAction3Trigglered()));
connect(action3, SIGNAL(changed()), this, SLOT(onAction3Trigglered()));
menu->addAction(action3);

//但是按钮设置快捷键有效
ui->pushButton->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_E));

求解如何设置右键菜单的快捷键

  • 写回答

3条回答

  • threenewbee 2017-02-24 14:59
    关注
    评论

报告相同问题?