#include <QApplication>#include <QSplashScreen>#include <QPixmap>#include <mainwindow.h>#include <QDateTime>#include <QDebug>
int main(int argc, char *argv[]){ QApplication app(argc, argv);
QPixmap pixmap("screen.png"); QSplashScreen screen(pixmap); screen.show(); app.processEvents(); screen.showMessage("LOVE");
QDateTime n=QDateTime::currentDateTime();
QDateTime now; do{ now=QDateTime::currentDateTime(); } while (n.secsTo(now)<=5);//6为需要延时的秒数
MainWindow window; window.show();
screen.finish(&window);
return app.exec();}
上面这段代码,启动画面总是一闪而过,看了网上说法加延时,但是感觉这个延时加的是整个程序(启动画面+window启动)的延时,而不是启动画面运行的延时,有谁知道这是啥原因吗?要如何解决啊?