離線 藝術人生
|
— 本帖被 XChinux 執行加亮操作(2016-04-23) — #include "mainwindow.h" #include <QApplication> #include <QSplashScreen> #include <QTextEdit> #include <QPixmap> #include <QTest> //需要在工程文件當中加入 QT += testlib
int main(int argc, char *argv[]) { QApplication a(argc, argv);
QSplashScreen *splash = new QSplashScreen(); splash->setPixmap(QPixmap(":/p_w_picpaths/lubuntu_logo.png")); splash->show();
a.processEvents(); //這句話必須加上,不加的話,無法實現效果。
//QTest::qSleep(3000);
splash->showMessage(QObject::tr("Loading modules..."), Qt::AlignCenter, Qt::blue); QTest::qSleep(6000);
MainWindow w; w.show(); splash->finish(&w); delete splash;
return a.exec(); } |