Qt应用程序启动界面:
#include <QApplication>
#include <QSplashScreen>
#include <QPixmap>
#include <mainwindow.h>
#include <QDebug>
#include <QElapsedTimer>
#include <QDateTime>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPixmap pixmap("screen.png");
QSplashScreen screen(pixmap);
screen.show();
screen.showMessage("LOVE", Qt::AlignCenter, Qt::red);
/*
int delayTime = 5;
QElapsedTimer timer;
timer.start();
while(timer.elapsed() < (delayTime * 1000))
{
app.processEvents();
}
*/
QDateTime n=QDateTime::currentDateTime();
QDateTime now;
do{
now=QDateTime::currentDateTime();
app.processEvents();
} while (n.secsTo(now)<=5);//5为需要延时的秒数
MainWindow window;
window.show();
screen.finish(&window);
return app.exec();
}