我试图为退出操作添加一个快捷方式。但是它没有显示在菜单中。
代码如下:
exitAct = new QAction(tr("&Exit"), this);
exitAct->setShortcuts(QKeySequence::Quit);
exitAct->setStatusTip(tr("Exit the application"));
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
我对打印快捷方式进行了同样的尝试,它起作用了,所以我看不出我做错了什么。有没有人知道如何解决它?
最佳答案
请注意,对于 Mac OS X,Ctrl+Q 被分配给 QKeySequence::Quit,但对于 Windows 则没有。对于 Windows,没有键盘快捷键分配给 QKeySequence::Quit。
Qt 文档的屏幕截图:
关于c++ - QKeySequence::Quit 快捷方式在 Windows 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24301611/