Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt: printscreen key in keyPressEvent

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?

like image 500
Dmitry Bardyshev Avatar asked Dec 02 '25 09:12

Dmitry Bardyshev


1 Answers

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

like image 158
Jonathan Mee Avatar answered Dec 05 '25 00:12

Jonathan Mee