QT28 how to display a splash screen in qt

modify main.cpp


#include "mainwindow.h"
#include <QApplication>

#include <QSplashScreen>
#include <QTimer>

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

    QSplashScreen *splash = new QSplashScreen();
    splash->setPixmap(QPixmap("C:/TestQT/QT_SQLite/Tutorial7_How_to_connect_Qt_to_SQLite/Sqlite_DB/icon/panda.png"));
    splash->show();
    MainWindow w;

    QTimer::singleShot(5000, splash, SLOT(close()));
    QTimer::singleShot(5000, &w, SLOT(show()));


    return a.exec();
}


你可能感兴趣的:(QT28 how to display a splash screen in qt)