PDA

View Full Version : Transparency propagation question



gianpatt
30th September 2009, 17:37
Hello all,
in my application i'd like to set opacity only to the top level window but not for childs widget.

Reading the qt manual at http://doc.trolltech.com/4.5/qwidget.html seems that just add setAutoFillBackground to central widget to avoid propagation. It's correct?

This is the example image from qt page:
http://doc.trolltech.com/4.5/images/propagation-custom.png

I wrote a test but not work:



#include <QtGui>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);

QWidget widget;
widget.setWindowOpacity(0.7);
QGroupBox box("Hello Sample", &widget);
box.setAutoFillBackground(true);

widget.show();

return a.exec();
}


where am I wrong?
Thank you

wysota
30th September 2009, 17:54
Opacity is always propagated to child widgets. The docs you mention are related to propagating the background, not opacity.