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.2k 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.
  • 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
                                • ManiRonM ManiRon

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

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

                                  @ManiRon

                                  • QLabel *processLabel = new QLabel(NULL); ?
                                    Yes. will make it window.'

                                  Yes, it should be.
                                  Just dont call w.show() before u want to.

                                  ManiRonM 2 Replies Last reply
                                  0
                                  • mrjjM mrjj

                                    @ManiRon

                                    • QLabel *processLabel = new QLabel(NULL); ?
                                      Yes. will make it window.'

                                    Yes, it should be.
                                    Just dont call w.show() before u want to.

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

                                    @mrjj

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

                                    this is what i use but this gif is not displaying now . Now it directly comes to the mainwindow but after the timeout which i have given in that QTimer

                                    1 Reply Last reply
                                    0
                                    • mrjjM mrjj

                                      @ManiRon

                                      • QLabel *processLabel = new QLabel(NULL); ?
                                        Yes. will make it window.'

                                      Yes, it should be.
                                      Just dont call w.show() before u want to.

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

                                      @mrjj
                                      Now This is my code in Main.cpp
                                      QMovie *movie = new QMovie("C:/Users/data/Documents/untitled14/200w.gif");
                                      QLabel *processLabel = new QLabel(NULL);
                                      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 This is my code in Main.cpp
                                        QMovie *movie = new QMovie("C:/Users/data/Documents/untitled14/200w.gif");
                                        QLabel *processLabel = new QLabel(NULL);
                                        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
                                        #24

                                        @ManiRon
                                        maybe u need processLabel->show();

                                        ManiRonM 4 Replies Last reply
                                        0
                                        • mrjjM mrjj

                                          @ManiRon
                                          maybe u need processLabel->show();

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

                                          @mrjj 0_1536120715857_Maniakndan.jpg

                                          Now its showing sir,
                                          But is there anyway to make show it in a different way

                                          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