QT窗口显示动态gif图片

头文件加入

#include <QMovie>
#include <QLabel>

源码是

#include "mainwindow.h"

#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
QLabel *ww= new QLabel(this);
setCentralWidget(ww);

ww->setAutoFillBackground(1);

//gif图片位置随自己的资源文件位置改变

QMovie *pic=new QMovie(":/image/123.gif");
ww->setMovie(pic);
pic->start();
}



猜你喜欢

转载自blog.csdn.net/qq_41133610/article/details/80017978
今日推荐