PDA

View Full Version : Transparency ... Again



EricF
30th November 2007, 19:26
Hi,

I searched and read alot of threads that talked about transparency. I actually tried lots of solution provided and then I ask you this :

What I want to achieve is a semi-transparent top level window with opaque or different transparency level children.

Now here's what I tried:

- setWindowOpacity() this is good but apply to children too so not what I want.
- Fill a QPixmap with Qt::Transparent and draw the pixmap and then draw other controls. This gives me the usual gray window without transparency.
- QPainter::setOpacity before QPainter::fillRect with an opaque color or only fillRect with a transparent color.

The latter two works if the floating window is a child of a main window but obviously, it get clipped if I try to move it outside of the main window.

Any way of doing it ? I'm using Qt 4.3.2 and Windows XP.


Another question unrelated. I tried setting backroung role like :

mainWindow->setBackgroundRole( QPalette:: Dark ); on my mainwindow and this doesn't do anything, any hints ?

marcel
30th November 2007, 20:17
On XP, your only solution is this:http://www.qtcentre.org/forum/f-qt-software-16/t-qskinwindows-classes-9301.html (I'm pretty sure I suggested this link to you before...)

EricF
30th November 2007, 20:30
I don't remember you suggesting that to me ...

svenflossmann
1st December 2007, 18:49
Grabing the content below the window via QPixmap::grabWidget() or QPixmap::grabWindow() and drawing this as background applied with an alpha might be a workaround.

Sven

marcel
1st December 2007, 20:52
Grabing the content below the window via QPixmap::grabWidget() or QPixmap::grabWindow() and drawing this as background applied with an alpha might be a workaround.

Sven
The performance would suck. There are platform dependent solutions that do exactly just that, but only much faster.