[Qt-interest] transparent window

David Boddie david.boddie at nokia.com
Mon Mar 30 17:35:41 CEST 2009


Alexander Vasiliev wrote:

> How can window be made transparent?
> 
> I've made simple widget window and tried to set Qt::WA_NoSystemBackground
> flag, but it draws black background. I drew transparent rect, but it still
> draws black background on Windows. On linux-framebuffer I can see another
> qt window underneath it, but nothing else, because it draws black
> everywhere else.
> 
> What else can i try?

If you want to make parts of the window transparent, you can use a window
mask:

http://doc.trolltech.com/4.5/qwidget.html#setMask

If you want the same level of partial transparency (tranlucency) for the
whole window, change the window opacity:

http://doc.trolltech.com/4.5/qwidget.html#windowOpacity-prop

If you want translucent windows with different levels of transparency in
different regions, set the Qt::WA_TranslucentBackground attribute and
paint the window as required:

http://doc.trolltech.com/4.5/qwidget.html#creating-translucent-windows

There's also an article about this subject here:

http://doc.trolltech.com/qq/QtQuarterly29.pdf

David
-- 
David Boddie
Senior Technical Writer
Nokia, Qt Software



More information about the Qt-interest-old mailing list