PDA

View Full Version : label with image and text



mattia
7th March 2008, 11:14
Hello, i'd like to set on a label an image and a text, i tried in this way but i'm not able to see the text, the Gui show me just the label.


QLabel * label;
label->setPixmap(QPixmap(QString::fromUtf8 ( ":/images/my.png" )));
label->setText( tr ("Terminal settings") );

thx

wysota
7th March 2008, 11:28
A single label shows either text or a pixmap by default (not both at once). Either use two labels or set a richt text string on the label that contains a pixmap:

label->setText(tr("<img src=\":/images/my.png\"/> Terminal settings"));