Qt程序启动画面QSplashScreen
QSplashScreen会在应用程序的主窗口出现之前显示一个图片!
#include "qmain.h"
#include
#include
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPixmap pixmap(":/MyPicture/Resources/president.jpg");
QSplashScreen *splash = new QSplashScreen(pixmap);
splash->show();
//显示信息
splash->showMessage("Wait...");
Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop;
splash->showMessage(QObject::tr("Setting up the main window..."),topRight, Qt::white);//显示信息
qApp->processEvents();//This is used to accept a click on the screen so that user can cancel the screen
QMain window;
window.setStyleSheet("* { background-color:rgb(199,147,88); padding: 7px}");
window.show();
//图片一直显示到mainWin加载完成
splash.finish(&window);
delete splash;
return app.exec();
}