Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, March 2007
Re: Semi- transparent QWidget


Message 1 in thread

Thanks Volker,



Really good explained, thanks again. You message make me understand the 
mechanism behind new Qt 4. backingstore" - "shining" principles. I'll try to 
make it as scenario 1 from your message it's simple seams most logical/ 
reliable and I trust Qt approach / I can not say the same for some OS and 
companies as M$/



Cheers,



Julian




"Volker Hilsheimer" <unwatched@xxxxxxx> wrote in message 
news:es3vpe$reb$1@xxxxxxxxxxxxxxxxxxxxx
>> I succeed to make it. It works perfect.
>>
>> My problem was / and still it is/ that I can not draw semi transparent 
>> rectangles over Qwiget which / here is the key moment/ playing Video . 
>> What I do is adding the MPlayer into a Widget and want to add semi 
>> transparent description as " What is this in Qt -Demo".
>>
>> I succeed to make a fully transparent QImage and to draw with QPainter 
>> over it and everything works fine. The problem is when I draw a semi 
>> transparent thing it comes as fully opaque. That is situation only over 
>> MPlayer running into Widget otherwise works perfectly.
>>
>> Do you have any idea how I can make it?
>
>
> Qt's support for semi transparent widget really is a feature of Qt; it's 
> not a feature of the windowing system that Qt just happened to start using 
> in version 4.2.
>
> For this to work, all widgets in the widget hierarchy have to cooperate. 
> I.e. all of them have to paint themselves into Qt's "backingstore", so 
> that Qt can correctly compose the look of the complete window. Any widget 
> that does not render into the backingstore will not, and cannot, shine 
> through other widgets that are on top, or of widgets below shine through.
>
> This means that any QWidget that has the PaintOnScreen flag set (i.e. 
> QGLWidget), and any window that is not a Qt widget, cannot participate in 
> the semi-transparency of Qt, unless you jump through several hopps to make 
> it work. I.e. you could just not show the MPlayer at all, but instead have 
> it provide the frames that you then paint into the QWidget using a 
> paintEvent implementation. However, this is naturally going to be very 
> slow and very heavy on the CPU (and I don't know enough about MPlayer to 
> say if you can do this in the first place).
>
> Alternatively, you can use toplevel widgets and modify their opacity. Qt 
> doesn't know what is "behind" a toplevel windows - only the windowing 
> system knows. So the windowing system, if it supports the notion of semi 
> transparent toplevel windows, can take care of the composition. But this 
> might again fail (or at least cause drastic performance decrease) in some 
> cases, i.e. your OpenGL rendering might start to go through the windowing 
> system rather than directly blt to the framebuffer.
>
>
> Volker
>
> 


--
 [ signature omitted ]