Qt: printscreen key in keyPressEvent

本秂侑毒 提交于 2019-12-07 12:16:12

问题


When I pressing keys, this code works, but not with Print Screen key.

void KeyHooker::keyPressEvent(QKeyEvent *event)
{
    qDebug() << event->key();
}

Q. How can I grab Print Screen key?


回答1:


The problem is that the OS grabs this before it reaches your code: http://qt-project.org/forums/viewthread/18610/#90901

You'll need to use Microsoft's LowLevelKeyboardProc in your code to do this: http://msdn.microsoft.com/en-us/library/ms644985%28v=VS.85%29.aspx



来源:https://stackoverflow.com/questions/27002328/qt-printscreen-key-in-keypressevent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!