Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to splash screen a gif video
Forum Updated to NodeBB v4.3 + New Features

How to splash screen a gif video

Scheduled Pinned Locked Moved Solved General and Desktop
53 Posts 3 Posters 16.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ManiRonM Offline
    ManiRonM Offline
    ManiRon
    wrote on last edited by
    #1

    I am trying to splash a gif video while opening my application . But its not playing like a gif video . it spalshes like an image. Is there any way i can make it splash like an video .

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      You can use QMovie

      QMovie *movie = new QMovie(":/images/other/images/16x16/loading.gif");
      QLabel *processLabel = new QLabel(this);
      processLabel->setMovie(movie);
      movie->start();

      ManiRonM 1 Reply Last reply
      1
      • mrjjM mrjj

        Hi
        You can use QMovie

        QMovie *movie = new QMovie(":/images/other/images/16x16/loading.gif");
        QLabel *processLabel = new QLabel(this);
        processLabel->setMovie(movie);
        movie->start();

        ManiRonM Offline
        ManiRonM Offline
        ManiRon
        wrote on last edited by ManiRon
        #3

        @mrjj said in How to splash screen a gif video:

        QMovie *movie = new QMovie(":/images/other/images/16x16/loading.gif");
        QLabel *processLabel = new QLabel(this);
        processLabel->setMovie(movie);
        movie->start();

        previously i used this :

        QSplashScreen *splash = new QSplashScreen;

        splash->setPixmap(QPixmap("C:/Users/data/Documents/untitled14/giphy.gif"));
        splash->show();
        

        QTimer::singleShot(2500,movie,SLOT(close()));
        QTimer::singleShot(2500,&w,SLOT(show()));

        1 Reply Last reply
        0
        • ManiRonM Offline
          ManiRonM Offline
          ManiRon
          wrote on last edited by
          #4

          this should run when an application icon is clicked .

          mrjjM 1 Reply Last reply
          0
          • ManiRonM ManiRon

            this should run when an application icon is clicked .

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @ManiRon
            QLabel will not show animated gif unless setMovie is used.

            ManiRonM 1 Reply Last reply
            0
            • mrjjM mrjj

              @ManiRon
              QLabel will not show animated gif unless setMovie is used.

              ManiRonM Offline
              ManiRonM Offline
              ManiRon
              wrote on last edited by
              #6

              @mrjj

              Now i am trying like this in my main.cpp file :

              QMovie *movie = new QMovie("C:/Users/data/Documents/untitled14/giphy.gif");
              QLabel *processLabel = new QLabel(&w);
              processLabel->setMovie(movie);
              movie->start();

              QTimer::singleShot(2500,movie,SLOT(stop()));
              QTimer::singleShot(2500,&w,SLOT(show()));
              
              mrjjM 1 Reply Last reply
              0
              • ManiRonM ManiRon

                @mrjj

                Now i am trying like this in my main.cpp file :

                QMovie *movie = new QMovie("C:/Users/data/Documents/untitled14/giphy.gif");
                QLabel *processLabel = new QLabel(&w);
                processLabel->setMovie(movie);
                movie->start();

                QTimer::singleShot(2500,movie,SLOT(stop()));
                QTimer::singleShot(2500,&w,SLOT(show()));
                
                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @ManiRon
                hi
                seems fine and i assume its in main.cpp ?

                ManiRonM 2 Replies Last reply
                0
                • mrjjM mrjj

                  @ManiRon
                  hi
                  seems fine and i assume its in main.cpp ?

                  ManiRonM Offline
                  ManiRonM Offline
                  ManiRon
                  wrote on last edited by
                  #8

                  @mrjj yes sir

                  1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @ManiRon
                    hi
                    seems fine and i assume its in main.cpp ?

                    ManiRonM Offline
                    ManiRonM Offline
                    ManiRon
                    wrote on last edited by
                    #9

                    @mrjj when i ran this i got QObject::connect: No such slot QMovie::close() in main.cpp:23 this error

                    mrjjM 1 Reply Last reply
                    0
                    • ManiRonM ManiRon

                      @mrjj when i ran this i got QObject::connect: No such slot QMovie::close() in main.cpp:23 this error

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      Hi
                      well, it means QMovie do not have a close slot.
                      it has
                      alt text

                      so maybe you mean stop ?

                      ManiRonM 2 Replies Last reply
                      0
                      • mrjjM mrjj

                        Hi
                        well, it means QMovie do not have a close slot.
                        it has
                        alt text

                        so maybe you mean stop ?

                        ManiRonM Offline
                        ManiRonM Offline
                        ManiRon
                        wrote on last edited by
                        #11

                        @mrjj yes i changed it and ran the program but still the gif is not playing and the mainwindow is displaying directly

                        1 Reply Last reply
                        0
                        • mrjjM mrjj

                          Hi
                          well, it means QMovie do not have a close slot.
                          it has
                          alt text

                          so maybe you mean stop ?

                          ManiRonM Offline
                          ManiRonM Offline
                          ManiRon
                          wrote on last edited by
                          #12

                          @mrjj the gif is playing but it plays at the top right corner of the mainwindow

                          1 Reply Last reply
                          0
                          • JohanSoloJ Offline
                            JohanSoloJ Offline
                            JohanSolo
                            wrote on last edited by
                            #13

                            @ManiRon This means you didn't put properly the QLabel in a layout or set it as the central widget.

                            `They did not know it was impossible, so they did it.'
                            -- Mark Twain

                            ManiRonM 1 Reply Last reply
                            0
                            • ManiRonM Offline
                              ManiRonM Offline
                              ManiRon
                              wrote on last edited by
                              #14

                              0_1536060443069_Untitled1.jpg

                              the indicated part is the loading gif but it comes in the mainwindow

                              mrjjM 1 Reply Last reply
                              0
                              • ManiRonM ManiRon

                                0_1536060443069_Untitled1.jpg

                                the indicated part is the loading gif but it comes in the mainwindow

                                mrjjM Offline
                                mrjjM Offline
                                mrjj
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

                                @ManiRon
                                Hi
                                Please show the complete main.cpp code

                                ManiRonM 1 Reply Last reply
                                0
                                • JohanSoloJ JohanSolo

                                  @ManiRon This means you didn't put properly the QLabel in a layout or set it as the central widget.

                                  ManiRonM Offline
                                  ManiRonM Offline
                                  ManiRon
                                  wrote on last edited by ManiRon
                                  #16

                                  @JohanSolo my doubt is i want to display the loading gif first then after a small amount of time the mainwindow. I have added the code which i have used kindly can u see that and point out if there is any mistake sir.
                                  Thanks.

                                  1 Reply Last reply
                                  0
                                  • mrjjM mrjj

                                    @ManiRon
                                    Hi
                                    Please show the complete main.cpp code

                                    ManiRonM Offline
                                    ManiRonM Offline
                                    ManiRon
                                    wrote on last edited by ManiRon
                                    #17

                                    @mrjj

                                    This is the main.cpp full code sir

                                    QApplication a(argc, argv);
                                    MainWindow w;

                                    QMovie *movie = new QMovie("C:/Users/data/Documents/untitled14/200w.gif");
                                    QLabel *processLabel = new QLabel(&w);
                                    processLabel->setMovie(movie);
                                    movie->start();
                                    
                                    QTimer::singleShot(5000,movie,SLOT(stop()));
                                    QTimer::singleShot(2500,&w,SLOT(show()));
                                    
                                    mrjjM 1 Reply Last reply
                                    0
                                    • ManiRonM ManiRon

                                      @mrjj

                                      This is the main.cpp full code sir

                                      QApplication a(argc, argv);
                                      MainWindow w;

                                      QMovie *movie = new QMovie("C:/Users/data/Documents/untitled14/200w.gif");
                                      QLabel *processLabel = new QLabel(&w);
                                      processLabel->setMovie(movie);
                                      movie->start();
                                      
                                      QTimer::singleShot(5000,movie,SLOT(stop()));
                                      QTimer::singleShot(2500,&w,SLOT(show()));
                                      
                                      mrjjM Offline
                                      mrjjM Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on last edited by mrjj
                                      #18

                                      @ManiRon

                                      QLabel *processLabel = new QLabel(&w); << u set main win as parent so its shown inside.
                                      if its to be like window BEFORE mainwin comes, use null as parent.

                                      ManiRonM 2 Replies Last reply
                                      1
                                      • mrjjM mrjj

                                        @ManiRon

                                        QLabel *processLabel = new QLabel(&w); << u set main win as parent so its shown inside.
                                        if its to be like window BEFORE mainwin comes, use null as parent.

                                        ManiRonM Offline
                                        ManiRonM Offline
                                        ManiRon
                                        wrote on last edited by
                                        #19

                                        @mrjj Now i should give as QLabel *processLabel = new QLabel(NULL); ?

                                        1 Reply Last reply
                                        0
                                        • mrjjM mrjj

                                          @ManiRon

                                          QLabel *processLabel = new QLabel(&w); << u set main win as parent so its shown inside.
                                          if its to be like window BEFORE mainwin comes, use null as parent.

                                          ManiRonM Offline
                                          ManiRonM Offline
                                          ManiRon
                                          wrote on last edited by ManiRon
                                          #20

                                          @mrjj i should display the gif file then the mainwindow, is that possible sir?

                                          mrjjM 1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved