QT 的gif播放例子及应用于启动界面的一般做法!
源码:(1)
#include <QtGui/QApplication>
#include "mainwindow.h"
#include <QProcess>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QProcess* p = new QProcess();
QString prg = "Splash";
p->start (prg);
p->waitForStarted (-1);
MainWindow w;
p->close ();
w.show();
return a.exec();
}
源码:(2)
#include <QtGui/QApplication>
#include <QProcess>
#include <QSplashScreen>
#include <QLabel>
#include <QMovie>
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(Splash);
QApplication a(argc, argv);
QSplashScreen splash(QPixmap(":/splash.gif"));
QLabel lbl(&splash);
QMovie mv(":/splash.gif");
lbl.setMovie (&mv);
mv.start ();
splash.show ();
return a.exec();
}