View Full Version : top level keyPressEvent

14th September 2010, 22:37
I have some buttons with arrow pictures inside a QMainWindow. I would also like to be able to capture keyboard arrow events.

The problem is when other widgets receive keyboard focus, they capture the keyboard events before they get to QMainWindow::keyPressEvent().

Is there some kind of top level signal or virtual function I can override to notify my class when an arrow key is pressed?

I've seen some similar posts, but I want to make sure on this. I don't want to subclass all the widgets in my window so they pass their key events up the hierarchy.

Thanks for your help!

14th September 2010, 22:42
Install an event filter on the child widgets you wish to intercept events from.