【问题标题】:QKeySequence::Quit shortcut not working in WindowsQKeySequence::Quit 快捷方式在 Windows 中不起作用
【发布时间】:2014-06-19 08:02:45
【问题描述】:

我尝试为退出操作添加快捷方式。但是它没有显示在菜单中。

代码如下:

exitAct = new QAction(tr("&Exit"), this);
exitAct->setShortcuts(QKeySequence::Quit);
exitAct->setStatusTip(tr("Exit the application"));    
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));

我为打印快捷方式尝试了同样的方法,它可以正常工作,所以我看不出我在这里做错了什么。有人知道如何修复它吗?

【问题讨论】:

    标签: c++ windows qt


    【解决方案1】:

    注意 Ctrl+Q 分配给 Mac OS X 的 QKeySequence::Quit,但不适用于 Windows。对于 Windows,没有为 QKeySequence::Quit 分配键盘快捷键。

    Qt 文档截图:

    【讨论】:

    • 谢谢,我以为 Ctrl+Q 也适用于 windows。
    • 没问题,我编辑了你的问题并用 Windows 标记了它。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-11-06
    • 1970-01-01
    • 2017-04-27
    • 1970-01-01
    • 2012-08-20
    • 1970-01-01
    • 2013-05-31
    相关资源
    最近更新 更多