Qt : Create SplashScreen

Qt : Create SplashScreen

This is a simple tutorial how Qt : Create SplashScreen. A splash screen is an image that appears while a game or program is loading. It may also be used to describe an introduction page on a website. Splash screens cover the entire screen or simply a rectangle near the center of the screen. The splash screens of operating systems and some applications that expect to be run full-screen usually cover the entire screen (wikipedia).

Qt have a class QSplashScreen to create SplashScreen. This is the sample code how Qt : Create SplashScreen :

#include <QApplication>
#include <QSplashScreen>
#include "mainwindow.h"
#include <QTimer>
#include <QThread>
class I : public QThread
    static void sleep(unsigned long secs) {

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

    QPixmap pix(":/new/prefix1/SplashScreen.png");
    QSplashScreen splash(pix);

    //This line represents the alignment of text, color and position
    splash.showMessage(QObject::tr("Loading Programs........."),
                       Qt::AlignCenter | Qt::AlignBottom, Qt::black);

    MainWindow w;
    I::sleep(6);               // Splash page is shown for 5 seconds
    return a.exec();

Create a resource file and add your image png file. This is my sample resource file for this Qt : Create SplashScreen project :

    <qresource prefix="/new/prefix1">

This is a sample output from this Qt : Create SplashScreen :


You can donwload the complete code for this Qt : Create SplashScreen at here.

Source :


Add a Comment

Your email address will not be published. Required fields are marked *