PDA

View Full Version : Qt5 Translucent/alpha channel problems



superpacko
19th February 2013, 18:27
I've downloaded the latest Qt 5.0.1 for Windows 7 32 bits and ported a simple aplication that uses WA_TranslucentBackground. It seems that something is broken, since the widget is not been displayed, same code works fine in 4.8.1.

For a simple test:


Form::Form(QWidget *parent) :
QWidget(parent, Qt::FramelessWindowHint)
{
ui.setupUi(this);
setAttribute(Qt::WA_TranslucentBackground);
}

Form is a QWidget that has another QWidget inside with a blue background.

I've also noted somethign else. I tried removing the WA_TranslucentBackground, and that works just fine. Then i changed the style sheet of the top level QWidget to use a background color with alpha channel. That failed again, if you set an alpha channel lower than 255 then the widget is not displayed at all, same behaviour like when using WA_TranslucentBackground.

so, to sum up:
1) using Qt::FramelessWindowHint + Qt::WA_TranslucentBackground: QWidget not displayed
2) using Qt::FramelessWindowHint + top level widget’s background color and alpha channel < 255: QWidget not displayed
3) using top level widget’s background color and alpha channel < 255: QWidget not displayed
4) using Qt::FramelessWindowHint + top level widget’s background color and alpha channel = 255: OK QWidget displayed

I guess there's something broken with the alpha channels, and that might be related with the WA_TranslucentBackground issue as well.

Any ideas or someone that has experienced the same thing?

Thanks!