Reputation: 1809
I'm using Qt 4.6 with a simple apps that only has a QMainwindow with a background image (set via the stylesheet property to an image in a ressource file).
If a add a QLabel on the this window and set it's background-color (also via stylesheet), the resulting label is not opaque. The background color of the label is not fill with the color I choose. Instead the result is a weird mix of the pixel of the background image.
If I remove the background image of the main window, the label is filled with it's background color correctly.
I've tried to play with the autoFillBackground property of the label and also with the Qt::WidgetAttribute set via the label->setAttribute() function without success.
Anybody has a idea why I got this result and how to solve this problem?
Upvotes: 2
Views: 1588
Reputation: 46
This works for me on Win7 + Qt 4.7.1
setStyleSheet("QMainWindow { background-image: url(:/bg.jpg); } \
QLabel { background-color: rgba(0, 255, 0, 90); } ");
Upvotes: 3