View Full Version : Weird setStyleSheet() behavior in Qt 5.3

10th June 2014, 17:00
I have a base class that contains a QFrame object called contentWidget. On that frame I set a default background color in the constructor like this

this->contentWidget->setStyleSheet(" \
QFrame#ZWindowContentWidget { \
background-color: " + backgroundColor + "; \
} \

I have a subclass that sets a background image on that frame also in the constructor like this:

getContentWidget()->setStyleSheet("background-image: url(" + fileName + ")");

What I expect to happen, and what actually was the case in the last few years, is that my image will be displayed over the frame. However, since I've switched to Qt 5.3 this doesn't happen anymore, I get the default background color. If I comment the code in the base class, which I obviously don't want to do, I can see the image again.

Does anyone know what's happening here? :p