[Development] "Native event" filter

David Faure david.faure at kdab.com
Fri Jul 20 21:04:39 CEST 2012


On Tuesday 26 June 2012 13:17:27 Thomas McGuire wrote:
> Hi,
> 
> On Tuesday 26 June 2012 12:48:56 David Faure wrote:
> > So I looked further into this, and discussed it with several people at
> > QtCS, and decided that not only the implementation needed fixing, the API
> > too. The current API can lead to crashes if removing install event filters
> > in a different order than the reverse-order-of-setting, and leads to ugly
> > code (global C function, which basically requires having a singleton).
> > 
> > In https://codereview.qt-project.org/#change,29260 I'm proposing a new
> > API:
> > 
> > QCoreApplication::instance()->installNativeEventFilter(obj);
> 
> I very much support this change and hope it will get into Qt 5.0. Currently
> the system is very brittle once you try to install more than one
> EventFilter, as the filters are chained, and the user of the API needs to
> remember to call the previous filter in the chain, or everything breaks. In
> addition, if one of the filters in the chain gets deleted, there are
> dangling pointers and again the whole chain is broken. Yet using
> EventFilters is unavoidable, for example the Blackberry QtMultimedia
> backend needs it to get multimedia update events. As this API solves all
> this, I'd really like to see that in Qt.

It's in, finally :-)

-- 
David Faure | david.faure at kdab.com | Managing Director KDAB France
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions




More information about the Development mailing list