[Qt-interest] Events on Transparent Window

BRM bm_witness at yahoo.com
Fri Feb 11 18:54:19 CET 2011


> From: Sean Hayes <sean.t.hayes at vanderbilt.edu>
>To: BRM <bm_witness at yahoo.com>
>Cc: Jason H <scorp1us at yahoo.com>; Qt Interest <qt-interest at trolltech.com>
>Sent: Fri, February 11, 2011 11:48:03 AM
>Subject: Re: [Qt-interest] Events on Transparent Window
>
>Ben,
>
>
>1. Define a new widget class - transparentWindowWidget, base the design on 
>QMdiSubWindow
>>2. in the new widget, when a widget is assigned, install an event filter.
>>3. do what you want on the events, you can prevent them from going down to the 

>>children as well.
>>
> I had not considered the QMdiSubWindow. Maybe having multiple QMdiSubWindows 
> behave differently than multiple regular windows and the events will get 
> propagated to the parent QMainWindow. Unlike with a cursor, touch points 
> can occur from multiple points simultaneously, It is important that all the 
> touch events come from the same widget (i.e., they propagate to a single 
> parent). I can install event filters on several widgets but then I will get 
> multiple touch events, each containing only a subset of all the active touch 
> points. I need a single set of QTouchEvents were each event contains all the 
> touch points. I will try it out this weekend and let everyone know if it works 

> with multiple touch contacts.
> 

You could create the multi-touch events as well - as each filter gives you an 
individual touch event just keep track of it occurring, then when you get two or 
more do you multi-touch event instead.
You could even report all widgets involved in the touch event as a result.

Now, I'm not saying that there shouldn't be a better way - like, Qt 
automatically detect which widget started the touch events and automatically 
associate all further touch events with that widget regardless of which widget 
they are starting over top of until all touch events cleared, but you could do 
that through the event filters instead - even telling the other widgets to not 
handle the events. Perhaps such a class could be a QTouchEventProxy?

In fact, using this method you could add it to the QMainWindow and all 
QMdiSubWindows as well.

Any how...just $0.02 for the pot.

HTH,

Ben




More information about the Qt-interest-old mailing list