Skip to content Skip to sidebar Skip to footer

OS X + Qt: How To Capture All Key-press Events In The Entire GUI?

I have a basic question about Qt and Mac OS X. If I define a QMainWindow class and define a keyPressEvent function as below, is it not supposed to enter this function whenever a ke

Solution 1:

When an event is used by a widget (e.g. an edit box), it is usually not propagated to its parent widgets, so you can't get these events from the parent window. You should install an event filter on the main QApplication object. This way you will receive (and filter if you want) all events.

See Event filters.


Post a Comment for "OS X + Qt: How To Capture All Key-press Events In The Entire GUI?"