background-image on QLabel does NOT work
QLabel#logo {
color: red;
background-image: url(folder/logobackground.png);
background-repeat: repeat-x;
background-origin: content;
}
Ok I have a QLabel with ObjectName as "logo".
I set the QLabel text to "boooooooooooooo" or some random text.
Also keeping in mind that minimum size for this QLabel is 400 pixels wide.
Now In CSS this would print logobackground.png on the QLabel about as many times as it can fit on the X-axis.
However, after 2 hours of struggling, I find that QLabel does NOT support background-image, and the documentation must have a typo or something.
I checked if it can find folder/logobackground.png at least 5 times so don't tell me I have wrong paths. I checked to make sure the Object name is there... in fact, the "boooooo" text does indeed become RED. But it seems QLabel does not support background-image attribute.
And Just to prove to anyone who doubts my competence in being able to get the paths right etc here is a small application for you to try that proves that QLabel does not support background-image:
Code:
hello.setObjectName("lol");
app.
setStyleSheet(QString("QLabel#logo { background-image: url(logobackground.png); }"));
hello.resize(500, 80);
hello.show();
Re: background-image on QLabel does NOT work
Could this be the problem:
Quote:
For QFrame and its subclasses, you must set the QFrame::frameStyle property to QFrame::StyledPanel; otherwise, the background and border attributes will not be respected.
?
Re: background-image on QLabel does NOT work
Yes I found that after 3 hours of trying several things... Really really dumb of them to do this and not document that properly. It should be written clearly next to QLabel in stylesheet.html