PDA

View Full Version : How to set all the labels transparent using "QLabel{background:transparent}" ?



sunRainPenguin
26th April 2015, 06:35
qApp->setStyleSheet("QLabel{background:transparent}");
lab2->setStyleSheet("background:transparent");
When I use these two statements above, there are different effects to the labels:

11134

The first statement can't make the labels transparent. And I need to know that how to make all the labels transparent when there's a background-image on the QMainWindow?

wysota
26th April 2015, 07:31
Make sure autoFillBackground property of the label is set to false.

sunRainPenguin
27th April 2015, 11:36
Thank you, wysota. I checked it again that the autoFillBackground property of the label is false. And now I set the background-image of the mainwindow in qss not in Qt-designer and this problem is disappeared:).