Reputation: 328
So i have a QLabel with a pixmap (added to it with the function setPixmap() ). Let's say now I add text to it with setText(). The QLabel starts displaying the text which is what I want it to do. And now is my question - is there a way to change the label back to start showing the previous pixmap rather than adding it again with setPixmap()?
Upvotes: 0
Views: 1682
Reputation: 430
This limitation from Qt 4.8 which still appears to be there can be overcome by using:
setStyleSheet("background-image: url(:/images/sunset.jpg);");
For more information see: Unable to set the background image in Qt Stylesheet
Upvotes: 0
Reputation: 10979
No.
http://qt-project.org/doc/qt-4.8/qlabel.html#text-prop
Here is written that setting text to QLabel clears any previous content.
Upvotes: 1