The QLabel widget provides a text or image display.
Content | Setting |
Plain text | Pass a QString to setText(). |
Rich text | Pass a QString that contains rich text to setText(). |
A pixmap | Pass a QPixmap to setPixmap(). |
A movie | Pass a QMovie to setMovie(). |
A number | Pass an int or a double to setNum(), which converts the number to plain text. |
Nothing | The same as an empty plain text. This is the default. Set by clear(). |
Header: | #include <QLabel> |
qmake: | QT += widgets |
Inherits: | QFrame |
插入图片:
插入动态图片:
QMovie *movie = new QMovie("../cruiseSystem/images/2015111016272032815.gif"); ui->label->setMovie(movie); QSize size = ui->label->size(); movie->setScaledSize(size); movie->start();