1.效果
2.代码
#include "mainwindow.h"
#include <QApplication>
#include <QLabel>
#include <QMovie>
#include <QSplashScreen>
#include <QThread>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QPixmap pixmapImage(":/face.jpg"); // 图片
QPixmap pixmapGif(":/loading.gif"); // 动画
QSplashScreen splashImage(pixmapImage);
QSplashScreen splashGif(pixmapGif);
QMovie* pMovie = new QMovie(":/loading.gif");
QLabel* pLabel = new QLabel(&splashGif);
pLabel->setMovie(pMovie);
pMovie->start();
splashImage.show();
splashGif.show();
MainWindow w;
w.show();
splashImage.finish(&w);
splashGif.finish(&w);
return a.exec();
}