QLabel with <img>
Solved
General and Desktop
-
I have a png file with a transparent background.
which I used with a QLabel like this:
QString text{ "<img border=\"0\" src=\":/Heart.png\" width=\"20\" height=\"20\"> " }; : label.setText(text);
I expected the background of the label to show through, but this is what I actually saw:
IOW the png wasn't displayed with transparent background?
What's wrong?
Thanks, David
-
@Perdrix said in QLabel with <img>:
What's wrong?
You could try
label.setAttribute(Qt::WA_TranslucentBackground);
Otherwise I would say
QLabel::setText
combined with HTML code for images doesn't support transparency, but maybe somebody knows better :)Never done this way before (with transparency).
-
S SGaist has marked this topic as solved on