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
    hi
    Yes, you can remove the decorations.
    https://stackoverflow.com/questions/3948441/how-to-remove-the-window-border-containing-minimize-maximize-and-close-buttons

    ManiRonM Offline
    ManiRonM Offline
    ManiRon
    wrote on last edited by ManiRon
    #32
    This post is deleted!
    1 Reply Last reply
    0
    • ManiRonM ManiRon

      @mrjj I found it sir,

      i used
      QLabel *processLabel = new QLabel(NULL);
      processLabel->setAlignment(Qt::AlignCenter);

      Now my doubt is , Its not aligning at all.

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

      @ManiRon
      HI
      Thats the internal aligment :)

      I assume you mean to center window onthe screen / desktop
      https://wiki.qt.io/How_to_Center_a_Window_on_the_Screen

      ManiRonM 1 Reply Last reply
      0
      • mrjjM mrjj

        @ManiRon
        HI
        Thats the internal aligment :)

        I assume you mean to center window onthe screen / desktop
        https://wiki.qt.io/How_to_Center_a_Window_on_the_Screen

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

        @mrjj 0_1536140517541_Untitled.jpg its coming like this when i use code from the above mentioned link

        mrjjM 1 Reply Last reply
        0
        • ManiRonM ManiRon

          @mrjj 0_1536140517541_Untitled.jpg its coming like this when i use code from the above mentioned link

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

          @ManiRon
          you do that on label ?

          anyway, you should set both alignments so movie is in center
          alt text

          ManiRonM 1 Reply Last reply
          0
          • mrjjM mrjj

            @ManiRon
            you do that on label ?

            anyway, you should set both alignments so movie is in center
            alt text

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

            @mrjj

            This is my code

            processLabel->setGeometry(
            QStyle::alignedRect(
            Qt::LeftToRight,
            Qt::AlignCenter,
            processLabel->size(),
            qApp->desktop()->availableGeometry()

            mrjjM 1 Reply Last reply
            0
            • ManiRonM ManiRon

              @mrjj

              This is my code

              processLabel->setGeometry(
              QStyle::alignedRect(
              Qt::LeftToRight,
              Qt::AlignCenter,
              processLabel->size(),
              qApp->desktop()->availableGeometry()

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

              @ManiRon
              ok.
              well u need to center the movie also or
              set size of label to size of movie.

              ManiRonM 1 Reply Last reply
              0
              • mrjjM mrjj

                @ManiRon
                ok.
                well u need to center the movie also or
                set size of label to size of movie.

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

                @mrjj

                i have to do both sir .

                mrjjM 1 Reply Last reply
                0
                • ManiRonM ManiRon

                  @mrjj

                  i have to do both sir .

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

                  @ManiRon
                  well to be on safe size u can do that.
                  use resize to size label to width, height of movie

                  ManiRonM 2 Replies Last reply
                  0
                  • mrjjM mrjj

                    @ManiRon
                    well to be on safe size u can do that.
                    use resize to size label to width, height of movie

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

                    @mrjj not getting your point

                    mrjjM 1 Reply Last reply
                    0
                    • mrjjM mrjj

                      @ManiRon
                      well to be on safe size u can do that.
                      use resize to size label to width, height of movie

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

                      @mrjj

                      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->setGeometry(
                      QStyle::alignedRect(
                      Qt::RightToLeft,
                      Qt::AlignCenter,
                      processLabel->size(),
                      qApp->desktop()->availableGeometry()
                      ));
                      processLabel->show();

                      This Is my current code

                      1 Reply Last reply
                      0
                      • ManiRonM ManiRon

                        @mrjj not getting your point

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

                        @ManiRon
                        you can use
                        processLabel->resize( some width, some height )
                        and i told u how to center movie in label already

                        ManiRonM 1 Reply Last reply
                        0
                        • mrjjM mrjj

                          @ManiRon
                          you can use
                          processLabel->resize( some width, some height )
                          and i told u how to center movie in label already

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

                          @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 1 Reply Last reply
                          0
                          • 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

                                          • Login

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