t5 杂谈(二)Qt5:Qt中启动画面的设置
离线
艺术人生
加关注
艺
术
人
生
— 本帖被 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();
}
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。