[Interest] Native event filter in QtService

Bo Thorsen bo at vikingsoft.eu
Fri Jun 24 11:18:47 CEST 2016


Hi all,

I'm copying this to devel, because it fits in a discussion a week or two 
ago.

Den 24-06-2016 kl. 10:56 skrev Tony Rietwyk:
> 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.

That is impossible for commercial projects because the solutions are 
LGPL only. You can't copy LGPL code into your own code base unless you 
are using GPL or LGPL yourself.

And that's why I copied this message to devel, because there was a 
discussion on whether to add solutions to Qt Core or not. And one of the 
arguments against is that people can just use the solutions as they are. 
This is one case, where apparently that's not (at least currently) possible.

I can come up with a couple of workarounds for this, sure. But these are 
all brittle and may not work if the solutions code is changed.

> *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
> NativeDeviceEventFilterclass based on QAbstractNativeEventFilter. It
> works perfectly when used in a QCoreApplication.
>
> Now, when installing this event filter in my UpdaterServiceclass, 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?

Bo Thorsen,
Director, Viking Software.

-- 
Viking Software
Qt and C++ developers for hire
http://www.vikingsoft.eu



More information about the Interest mailing list