PDA

View Full Version : Is there a Qt function to convert Windows virtual key into Qt key code?



jezz
21st December 2010, 16:18
I am creating a global key hook program, and I want to abstract my key processing. So I would want a function to convert platform keycode into Qt key code. For example, convert Windows virtual key into Qt key. For example: int convertToQtKey(int virtualKey)

Calling convertToQtKey(27) should return Qt::Key_Escape.

I googled and also searched Qt Assistant but found nothing.

Thanks.

javimoya
21st December 2010, 17:00
http://libqxt.bitbucket.org/doc/0.6/qxtglobalshortcut.html

internally there maybe you can find what you want

Peppy
21st December 2010, 20:12
Every key on keyboard is represented with ASCII, look at: http://brebru.com/asciicodes.html

jezz
23rd December 2010, 00:01
Thanks, I found suitable functions and a table in C:\Qt\4.7.1\src\gui\kernel\qkeymapper_win.cpp



http://libqxt.bitbucket.org/doc/0.6/qxtglobalshortcut.html
internally there maybe you can find what you want
This is helpful, but I guess the one in Qt source is better.


Every key on keyboard is represented with ASCII, look at: http://brebru.com/asciicodes.html
I think only part of the keyboard is represented with ASCII, eg A-Z, 0-9 etc.