[Interest] Native event filter in QtService

Tony Rietwyk tony at rightsoft.com.au
Fri Jun 24 10:56:32 CEST 2016


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 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/8c4c08d4/attachment.html>


More information about the Interest mailing list