Qt:keyPressEvent中的printscreen键 [英] Qt: printscreen key in keyPressEvent
本文介绍了Qt:keyPressEvent中的printscreen键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我按下按键时,此代码有效,但不能使用打印屏幕"键.
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?
推荐答案
The problem is that the OS grabs this before it reaches your code: http://qt-project.org/forums/viewthread/18610/#90901
您需要在代码中使用Microsoft的LowLevelKeyboardProc
来做到这一点:
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
这篇关于Qt:keyPressEvent中的printscreen键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文