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 15.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 ManiRon

    @mrjj

    Is this the one to center the movie

    processLabel->setAlignment(Qt::AlignCenter);

    for example,
    I added this in my code,

    processLabel->resize(100,100);
    error: invalid use of void expression
    )
    ^

    It showed this error

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

    @ManiRon
    yes.
    its AlignCenter = AlignVCenter | AlignHCenter

    ManiRonM 1 Reply Last reply
    0
    • mrjjM mrjj

      @ManiRon
      yes.
      its AlignCenter = AlignVCenter | AlignHCenter

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

      @mrjj after giving this also the gif is not aligining

      mrjjM 1 Reply Last reply
      0
      • ManiRonM ManiRon

        @mrjj after giving this also the gif is not aligining

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

        @ManiRon
        ok. not sure what goes wrong then.

        ManiRonM 1 Reply Last reply
        0
        • mrjjM mrjj

          @ManiRon
          ok. not sure what goes wrong then.

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

          @mrjj oh

          mrjjM 1 Reply Last reply
          0
          • ManiRonM ManiRon

            @mrjj oh

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

            @ManiRon
            but if u just resize label, is movie not in the center then ?

            ManiRonM 1 Reply Last reply
            0
            • mrjjM mrjj

              @ManiRon
              but if u just resize label, is movie not in the center then ?

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

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

              resize

              tried to resize but it throwed error

              processLabel->resize(100,100);
              error: invalid use of void expression
              )
              ^

              It showed this error

              mrjjM 1 Reply Last reply
              0
              • ManiRonM ManiRon

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

                resize

                tried to resize but it throwed error

                processLabel->resize(100,100);
                error: invalid use of void expression
                )
                ^

                It showed this error

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

                @ManiRon
                please show more of the code.
                it works here so error is due to do it in odd place or something else i cant see.

                ManiRonM 1 Reply Last reply
                0
                • mrjjM mrjj

                  @ManiRon
                  please show more of the code.
                  it works here so error is due to do it in odd place or something else i cant see.

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

                  @mrjj

                  #include "mainwindow.h"
                  #include <QApplication>
                  #include<QSplashScreen>
                  #include<QTimer>
                  #include<QMovie>
                  #include<QLabel>
                  #include<QLayout>
                  #include<QBoxLayout>
                  #include <QStyle>
                  #include <QDesktopWidget>

                  int main(int argc, char *argv[])
                  {
                  QApplication a(argc, argv);
                  MainWindow w;
                  QMovie *movie = new QMovie("C:/Users/data/Documents/untitled14/200w.gif");
                  QLabel *processLabel = new QLabel(NULL);
                  processLabel->setMovie(movie);
                  movie->start();
                  processLabel->setWindowFlags(Qt::FramelessWindowHint);
                  processLabel->setAlignment(Qt::AlignCenter);
                  processLabel->setGeometry(
                  QStyle::alignedRect(
                  Qt::LeftToRight,
                  Qt::AlignCenter,
                  processLabel->size(),
                  qApp->desktop()->availableGeometry()
                  )
                  );
                  processLabel->show();

                  QTimer::singleShot(2500,processLabel,SLOT(close()));
                  QTimer::singleShot(2500,&w,SLOT(show()));
                  //w.show();
                  return a.exec();
                  

                  }

                  My full main.cpp code

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

                    Hi
                    Your code works just fine ?

                    int main(int argc, char *argv[])
                    {
                    QApplication a(argc, argv);
                    MainWindow w;
                    
                    QMovie *movie = new QMovie(":/kTTdW2l.gif");
                    QLabel *processLabel = new QLabel(nullptr);
                    
                    processLabel->resize(200,200);  // to make sure its large enough
                    
                    processLabel->setMovie(movie);
                    processLabel->setWindowFlags(Qt::FramelessWindowHint);
                    processLabel->setAlignment(Qt::AlignCenter);
                    processLabel->setGeometry(  QStyle::alignedRect(Qt::LeftToRight,Qt::AlignCenter,processLabel->size(),qApp->desktop()->availableGeometry())         );
                    
                    movie->start();
                    processLabel->show();
                    
                    QTimer::singleShot(2500,processLabel,SLOT(close()));
                    QTimer::singleShot(2500,&w,SLOT(show()));
                    
                    return a.exec();
                    }
                    
                    ManiRonM 1 Reply Last reply
                    2
                    • mrjjM mrjj

                      Hi
                      Your code works just fine ?

                      int main(int argc, char *argv[])
                      {
                      QApplication a(argc, argv);
                      MainWindow w;
                      
                      QMovie *movie = new QMovie(":/kTTdW2l.gif");
                      QLabel *processLabel = new QLabel(nullptr);
                      
                      processLabel->resize(200,200);  // to make sure its large enough
                      
                      processLabel->setMovie(movie);
                      processLabel->setWindowFlags(Qt::FramelessWindowHint);
                      processLabel->setAlignment(Qt::AlignCenter);
                      processLabel->setGeometry(  QStyle::alignedRect(Qt::LeftToRight,Qt::AlignCenter,processLabel->size(),qApp->desktop()->availableGeometry())         );
                      
                      movie->start();
                      processLabel->show();
                      
                      QTimer::singleShot(2500,processLabel,SLOT(close()));
                      QTimer::singleShot(2500,&w,SLOT(show()));
                      
                      return a.exec();
                      }
                      
                      ManiRonM Offline
                      ManiRonM Offline
                      ManiRon
                      wrote on last edited by ManiRon
                      #53

                      @mrjj

                      yes sir, Now working fine

                      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