[Interest] Native event filter in QtService

Julius Bullinger Julius.Bullinger at asctec.de
Fri Jun 24 11:02:53 CEST 2016


Hi Tony,

thanks for your reply. Reading the documentation of QAbstractEventDispatcher::installNativeEventFilter(), it says in the fourth paragraph

                If multiple event filters are installed, the filter that was installed last is activated first.

Thus, I was under the impression that I should be able to add my own filter, without overwriting the one installed by QtService. Is this incorrect?

Regards,
Julius

Von: Interest [mailto:interest-bounces+julius.bullinger=asctec.de at qt-project.org] Im Auftrag von Tony Rietwyk
Gesendet: Freitag, 24. Juni 2016 10:57 Uhr
An: interest at qt-project.org
Betreff: Re: [Interest] Native event filter in QtService

Hi Julius,

qtservice_win.cpp around line 830 at your reference [1] installs its own nativeEventFilter - probably displacing yours.

I suspect you'll need to merge the Qt filter into yours, and get rid of that install.

Regards,

Tony


From: Interest [mailto:interest-bounces+tony=rightsoft.com.au at qt-project.org] On Behalf Of Julius Bullinger
Sent: Friday, 24 June 2016 5:25 PM
To: interest at qt-project.org<mailto:interest at qt-project.org> Interest
Subject: [Interest] Native event filter in QtService

I'm trying to write a small (windows only) service based on QtService [1] listening for some USB device events. For this, I created a NativeDeviceEventFilter class based on QAbstractNativeEventFilter. It works perfectly when used in a QCoreApplication.

Now, when installing this event filter in my UpdaterService class, it isn't being called.

I tried each of:


  application()->installNativeEventFilter(deviceEvent_);



  QCoreApplication::instance()->installNativeEventFilter(deviceEvent_);



  QAbstractEventDispatcher::instance()->installNativeEventFilter(deviceEvent_);

both in the service's constructor and start() method, as well as using a local instance of NativeDeviceEventFilter,
but none of these worked. The event just isn't registered at all.

Has anyone ever done something like this? Or is there another way to receive native messages (MSG structs) in a QtService?

Best regards,
Julius

[1]: https://github.com/qtproject/qt-solutions/tree/master/qtservice
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160624/62ca7812/attachment.html>


More information about the Interest mailing list