我正在尝试使用 QxtGlobalShortcut 为我的应用程序设置全局快捷方式。 这是我的代码:
QxtGlobalShortcut m_hotkeyHandle;
m_hotkeyHandle.setShortcut( QKeySequence("Ctrl+Shift+X") );
m_hotkeyHandle.setEnabled(true);
connect( &m_hotkeyHandle, SIGNAL(activated()),
this, SLOT(hotkeyPressed()) );
void MainWindow::hotkeyPressed()
{
QMessageBox::information(this, "Good", "Hot key triggered", "yes", "no");
}
但是在应用开始后我得到了:
QxtGlobalShortcut failed to register: "Ctrl+Shift+X"
而且我的程序在按下热键后没有激活。我该怎么办?
最佳答案
Qxt-lib 0.5 中存在快捷方式错误。我与开发人员交谈并知道我只需要从 dev-branch 更新库(0.5.1 可用)。
关于c++ - QxtGlobalShortcut 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1052691/