Hi, On Tuesday 26 June 2012 12:48:56 David Faure wrote: > ... but actually neither of these was working, except for the dispatcher > one on Windows. > The port to QPA broke the sending of native events, in particular. > > 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); > > with obj deriving from this interface: > > class QAbstractNativeEventFilter > { > virtual bool nativeEventFilter(const QByteArray &eventType, void > *message, long *result) = 0; }; > > This allows to provide removeNativeEventFilter(obj) as well. > > I thought making the change request was enough, but I was asked to post > here in order to get approval for the SIC change (replacing the old > setEventFilter with the above API).
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. Regards, Thomas -- Thomas McGuire | thomas.mcgu...@kdab.com | Software Engineer KDAB (Deutschland) GmbH&Co KG, a KDAB Group company Tel. Germany +49-30-521325470, Sweden (HQ) +46-563-540090 KDAB - Qt Experts - Platform-independent software solutions
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development