View Full Version : How to get the keycode from a class? not from widget's keypressevent()

31st August 2012, 15:58
I have a mainwindow::QWidget, several Child window(parent is mainwindow).
Normal way to get the keycode is from keyPressEvent(),but I need to focus the window, otherwise the key will not be passed to the window.
I think I should implement a class, which can read key from QWSServer, So I can get the keycode from a single function.
Creating a clash from QThread and using open("/dev/event0")-read() may be not a good way.Because QT has implemented it.

It looks like a global short-cut. My platform is an ARM-base embedded system, and the keyboard driver is OK, and I can get keycode if I rewrite keyPressEvent() (but I donot want it).

So , how to do it? thanks.