Qt:keyPressEvent中的printscreen键 [英] Qt: printscreen key in keyPressEvent

查看:323
本文介绍了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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆