Search code examples
c++qtloadingqsplashscreen

How to customize the loading screen in Qt?


I need to create a customized and animated loading screen in Qt, and I don't need a progress bar.

I want to do something like this:

enter image description here

Anyone knows how can I do that?

Can I use, for example, QSplashScreen?


Solution

  • Try QMovie to load an animation`

    QMovie * movie = new QMovie("https://i.sstatic.net/vdYAH.gif");
    

    You can either load the movie directly to a label, hide and show it when necessary

    QLabel label;
    label.setMovie(movie);
    movie->start();
    

    Or read the frames of the movie to set splash screen pixmap continuously

    connect(movie, SIGNAL(frameChanged(int)), this, SLOT(setSplashScreenPixmap(int)));
    movie->start();