//菜单设置快捷键无效
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));
求解如何设置右键菜单的快捷键