Ok, so I`ve gone through all the documentation I could find, and even looked at some Qt sources, but so far haven`t found a 'clean' way to emulate 'KeyPreview' (for those of you that have ever used WinForms).

What is the case - I have a project, that should be able to handle input from keyboard emulating devices (barcode scanners, card readers and so on). The trick is the user could technically input the stuff from the keyboard, so I monitor the interval between keypresses (and hope I don`t meet someone who can type a whole sentence within less than a second ). My main problem is that I should be able to intercept every keypress (no matter which widget is currently focused) and I should be doing it 100% transparently.

What I`ve tried so far is to recursively install an event filter for each child of the MainWindow, but it has the really nasty side effect that I handle the keypress up to 5 times. To make things even more fun - the 'eat/don`t eat' behavior of some widgets seems to change when I install event filter on them ...

I though about adding an eventFilter to the QApplication object, but that looks like an overkill.

Is there any way to pass every event for every child of a MainWindow through a single function, and to do so just once, without some thorough additional checking? If not - I would appreciate any ideas on the 'proper' way to do this.