[Development] "Native event" filter

David Faure faure at kde.org
Fri Jun 22 17:08:48 CEST 2012


On Friday 22 June 2012 10:14:22 Thiago Macieira wrote:
> On sexta-feira, 22 de junho de 2012 10.07.54, David Faure wrote:
> > QWindow and QWidget have a virtual method nativeEvent(), but this only
> > works for window-specific or widget-specific event handling.
> > 
> > Looking at the KDE code, I see a rather wide usage of process-level
> > handling of native events.
> > 
> > http://lxr.kde.org/ident?i=installX11EventFilter shows about 30 uses of
> > that.
> > 
> > >From idle detection to desktop-wide clipboard handling, color picking,
> > >RANDR
> > 
> > event handling, and so on.
> > This was all done via QApplication::x11EventFilter(), which doesn't seem
> > to
> > have a replacement in Qt5 yet.

It turns out that I'm wrong, there is 
QAbstractEventDispatcher::instance()->setEventFilter() already, for exactly 
this.

Strangely enough, there's QCoreApplication::setEventFilter too, but it says 
"It is not called for messages that are not meant for Qt objects."
I guess this means "messages meant for a Qt window", in practice.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. KDE Frameworks 5




More information about the Development mailing list