- int main(int argc, char *argv[])
- {
- QApplication a(argc, argv);
- //设置程序启动画面
- QSplashScreen *splash = new QSplashScreen;
- splash->setPixmap(QPixmap(":/p_w_picpaths/j7.jpg"));//加载启动图片
- splash->show();
- Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop;
- splash->showMessage(QObject::tr("Setting up the main window..."),topRight,Qt::white);
- splash->showMessage(QObject::tr("Establishing connection..."),topRight,Qt::white);
- QDateTime n2 = QDateTime::currentDateTime();//获取当前时间;
- QDateTime now;
- do
- {
- now = QDateTime::currentDateTime();
- } while (n2.secsTo(now) <= 5);//设置启动时间(延时)为5秒
- a.setWindowIcon(QIcon(":/p_w_picpaths/7.bmp"));
- MainWindow w;
- w.show();
- splash->finish(&w);//将控制权交给mainWin窗体
- delete splash;
- return a.exec();
- }
本文来源: http://blog.youkuaiyun.com/lwk0552/article/details/8193900
转载于:https://blog.51cto.com/2845385/1091094