[Qt-interest] trapping SPACE key in a widget without having focus?

Ian Clark mrrooster at gmail.com
Thu Sep 23 16:19:07 CEST 2010


On 22 September 2010 21:50, Paul Miller <paul at fxtech.com> wrote:
> I want one of my widgets to see all SPACE key events coming in, and then
> decide whether to eat it, without having explicit focus. Is this
> possible, with an event handler or something? It needs to work even when
> a text field might have focus.

I think you need to install an event filter, probably on the window
containing the widget you're dealing with.

http://doc.trolltech.com/4.6.2/qobject.html#installEventFilter

Has an example that deals with intercepting keypresses.

HTH,

Ian



More information about the Qt-interest-old mailing list