Qt程序启动画面

时间:2021-06-10 05:22:17

代码如下:

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QSplashScreen *splash=new QSplashScreen;
    splash->setPixmap(QPixmap(":/Game.jpg"));
    splash->show();

    Qt::Alignment topRight=Qt::AlignRight|Qt::AlignTop;
    splash->showMessage(QObject::tr("Setting up the application..."),topRight,Qt::white);

    MainWindow w;
    splash->showMessage(QObject::tr("Loading the modules..."),topRight,Qt::white);
//    loadModules();
    splash->showMessage(QObject::tr("Establing the connection..."),topRight,Qt::white);
    w.show();
    splash->finish(&w);
    delete splash;
    return a.exec();
}