Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. How to using GIF image for QT ?
QtWS25 Last Chance

How to using GIF image for QT ?

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
23 Posts 4 Posters 1.5k Views
  • 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.
  • N Offline
    N Offline
    Nguyen Thang Phong
    wrote on 31 Mar 2025, 08:01 last edited by
    #1

    QT : 6.7.3
    Installer Framework : 4.9
    MSVC : 2022
    1. Step build QT Static

    • git clone https://code.qt.io/qt/qt5.git
    • set PATH=C:\Phong\Libraries\Strawberry\perl\bin;%PATH%
    • cd qt5
    • git checkout 6.7.3
    • perl init-repository --module-subset=qtbase,qtsvg,qtdeclarative,qttools,qt5compat
    • set INCLUDE=C:\Phong\Libraries\MSVC\VC\Tools\MSVC\14.43.34808\atlmfc\include;%INCLUDE%
    • C:\Phong\Libraries\MSVC\setup_x64.bat
    • configure -static -prefix C:\Phong\Libraries\Qt-Static -opensource -confirm-license -qt-libpng -qt-libjpeg -qt-zlib -gif
    • cmake --build . --parallel
    • cmake --install . --prefix C:\Phong\Libraries\Qt-Static
      2. Step build QT installer framework
    • git clone https://github.com/qtproject/installer-framework.git
    • cd installer-framework
    • git checkout 4.9
    • C:\Phong\Libraries\MSVC\setup_x64.bat
    • set PATH=C:\Phong\Libraries\Qt-Static\bin;%PATH%
    • set LIB=C:\Phong\Libraries\Qt-Static\lib;%LIB%
    • set INCLUDE=C:\Phong\Libraries\Qt-Static\include;%INCLUDE%
    • qmake -r
    • nmake
      When using QMovie for GIF image, image not display ?
    J 1 Reply Last reply 31 Mar 2025, 08:55
    0
    • N Nguyen Thang Phong
      31 Mar 2025, 08:01

      QT : 6.7.3
      Installer Framework : 4.9
      MSVC : 2022
      1. Step build QT Static

      • git clone https://code.qt.io/qt/qt5.git
      • set PATH=C:\Phong\Libraries\Strawberry\perl\bin;%PATH%
      • cd qt5
      • git checkout 6.7.3
      • perl init-repository --module-subset=qtbase,qtsvg,qtdeclarative,qttools,qt5compat
      • set INCLUDE=C:\Phong\Libraries\MSVC\VC\Tools\MSVC\14.43.34808\atlmfc\include;%INCLUDE%
      • C:\Phong\Libraries\MSVC\setup_x64.bat
      • configure -static -prefix C:\Phong\Libraries\Qt-Static -opensource -confirm-license -qt-libpng -qt-libjpeg -qt-zlib -gif
      • cmake --build . --parallel
      • cmake --install . --prefix C:\Phong\Libraries\Qt-Static
        2. Step build QT installer framework
      • git clone https://github.com/qtproject/installer-framework.git
      • cd installer-framework
      • git checkout 4.9
      • C:\Phong\Libraries\MSVC\setup_x64.bat
      • set PATH=C:\Phong\Libraries\Qt-Static\bin;%PATH%
      • set LIB=C:\Phong\Libraries\Qt-Static\lib;%LIB%
      • set INCLUDE=C:\Phong\Libraries\Qt-Static\include;%INCLUDE%
      • qmake -r
      • nmake
        When using QMovie for GIF image, image not display ?
      J Offline
      J Offline
      JonB
      wrote on 31 Mar 2025, 08:55 last edited by
      #2

      @Nguyen-Thang-Phong
      Can you display the GIF image in, say, a QLabel rather than a QMovie?

      1 Reply Last reply
      0
      • N Offline
        N Offline
        Nguyen Thang Phong
        wrote on 31 Mar 2025, 09:00 last edited by Nguyen Thang Phong
        #3

        @JonB
        m_movie = new QMovie(gif);
        m_label->setMovie(m_movie);
        m_movie->start();
        and add QTPLUGIN += qgif into file .pro
        But not display when check using
        qDebug() << "supported formats: " << QImageReader::supportedImageFormats();
        supported formats: QList("bmp", "pbm", "pgm", "png", "ppm", "xbm", "xpm")

        J J 2 Replies Last reply 31 Mar 2025, 11:08
        0
        • N Nguyen Thang Phong
          31 Mar 2025, 09:00

          @JonB
          m_movie = new QMovie(gif);
          m_label->setMovie(m_movie);
          m_movie->start();
          and add QTPLUGIN += qgif into file .pro
          But not display when check using
          qDebug() << "supported formats: " << QImageReader::supportedImageFormats();
          supported formats: QList("bmp", "pbm", "pgm", "png", "ppm", "xbm", "xpm")

          J Offline
          J Offline
          JonB
          wrote on 31 Mar 2025, 11:08 last edited by JonB
          #4

          @Nguyen-Thang-Phong Per https://forum.qt.io/topic/53280/qmovie-gif-and-qrc where is your qgif.dll? Assuming that is still needed for Qt6.

          1 Reply Last reply
          0
          • N Offline
            N Offline
            Nguyen Thang Phong
            wrote on 31 Mar 2025, 12:07 last edited by
            #5

            @JonB
            I build qt static to custom installer framework is the path plugins/imageformats/qgif.lib, but when using binary creator to build app.exe using QLabel and QMovie but not display image ?

            1 Reply Last reply
            0
            • C Online
              C Online
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on 31 Mar 2025, 12:14 last edited by
              #6

              See https://doc.qt.io/qt-6/qtplugin.html#Q_IMPORT_PLUGIN and https://doc.qt.io/qt-6/plugins-howto.html#static-plugin on how to use static plugins

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              2
              • N Offline
                N Offline
                Nguyen Thang Phong
                wrote on 31 Mar 2025, 12:50 last edited by
                #7

                @Christian-Ehrlicher @JonB
                I added QTPLUSGIN += qgif into installer.pro
                After, I build source installer framework done.
                But I tested not display GIF image.

                1 Reply Last reply
                0
                • C Online
                  C Online
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on 31 Mar 2025, 12:53 last edited by
                  #8

                  My post contains two links...

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

                  1 Reply Last reply
                  1
                  • N Offline
                    N Offline
                    Nguyen Thang Phong
                    wrote on 31 Mar 2025, 14:27 last edited by
                    #9

                    @Christian-Ehrlicher

                    image.png
                    I tried but not working

                    1 Reply Last reply
                    0
                    • C Online
                      C Online
                      Christian Ehrlicher
                      Lifetime Qt Champion
                      wrote on 31 Mar 2025, 14:50 last edited by
                      #10

                      Then the path you given to QMovie does not exist. Check it

                      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                      Visit the Qt Academy at https://academy.qt.io/catalog

                      1 Reply Last reply
                      0
                      • N Offline
                        N Offline
                        Nguyen Thang Phong
                        wrote on 1 Apr 2025, 03:59 last edited by
                        #11

                        @Christian-Ehrlicher
                        I using pixmap to assign direct for GIF image but run not appear ?
                        No away to solution ...

                        1 Reply Last reply
                        0
                        • C Online
                          C Online
                          Christian Ehrlicher
                          Lifetime Qt Champion
                          wrote on 1 Apr 2025, 04:11 last edited by
                          #12

                          Again: Check if the file exists. E.g. with QFile::exists() ...

                          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                          Visit the Qt Academy at https://academy.qt.io/catalog

                          1 Reply Last reply
                          0
                          • N Offline
                            N Offline
                            Nguyen Thang Phong
                            wrote on 1 Apr 2025, 07:08 last edited by Nguyen Thang Phong 4 Jan 2025, 07:08
                            #13

                            @Christian-Ehrlicher @JonB
                            image.png
                            So, check supported image format to print formats bmp,pbm,pgm,png,ppm,xbm,xpm not found gif ?

                            1 Reply Last reply
                            0
                            • J Offline
                              J Offline
                              JonB
                              wrote on 1 Apr 2025, 07:20 last edited by JonB 4 Jan 2025, 07:20
                              #14

                              I do not know for sure that GIF should appear in supportedImageFormats(), though I agree I would have thought it should.
                              I suggested earlier that you try to display a GIF as an image on a QLabel, not in a QMovie.
                              @Christian-Ehrlicher asked you to verify that the path to the GIF file you test really does exist via QFile::exists().

                              J 1 Reply Last reply 1 Apr 2025, 12:21
                              0
                              • N Offline
                                N Offline
                                Nguyen Thang Phong
                                wrote on 1 Apr 2025, 07:32 last edited by
                                #15

                                @Christian-Ehrlicher @JonB
                                image.png
                                I tried add to pixmap

                                J 1 Reply Last reply 1 Apr 2025, 07:47
                                0
                                • N Nguyen Thang Phong
                                  1 Apr 2025, 07:32

                                  @Christian-Ehrlicher @JonB
                                  image.png
                                  I tried add to pixmap

                                  J Offline
                                  J Offline
                                  JonB
                                  wrote on 1 Apr 2025, 07:47 last edited by
                                  #16

                                  @Nguyen-Thang-Phong
                                  I do not use resources and I do not know whether that ../..../additonal.qrc path is right.
                                  What does QFile::exists(":/loading.gif") return?
                                  If you place a .gif file in your actual file system and try

                                  qDebug() << QFile::exists("c:/full/path/to/file.gif");
                                  // `label` is some `QLabel *` you have created and is visible in your UI
                                  label->setPixmap(new QPixmap("c:/full/path/to/file.gif"));
                                  

                                  (I think the above is right, untested, adjust as necessary) does that work?

                                  Otherwise I guess it is indeed a "static" issue, and only someone like @Christian-Ehrlicher knows what the issue might be.

                                  1 Reply Last reply
                                  0
                                  • J JonB
                                    1 Apr 2025, 07:20

                                    I do not know for sure that GIF should appear in supportedImageFormats(), though I agree I would have thought it should.
                                    I suggested earlier that you try to display a GIF as an image on a QLabel, not in a QMovie.
                                    @Christian-Ehrlicher asked you to verify that the path to the GIF file you test really does exist via QFile::exists().

                                    J Offline
                                    J Offline
                                    JoeCFD
                                    wrote on 1 Apr 2025, 12:21 last edited by JoeCFD 4 Jan 2025, 12:22
                                    #17

                                    @JonB I play a GIF file in a QMovie in a QLabel.

                                    J 1 Reply Last reply 1 Apr 2025, 12:45
                                    0
                                    • N Nguyen Thang Phong
                                      31 Mar 2025, 09:00

                                      @JonB
                                      m_movie = new QMovie(gif);
                                      m_label->setMovie(m_movie);
                                      m_movie->start();
                                      and add QTPLUGIN += qgif into file .pro
                                      But not display when check using
                                      qDebug() << "supported formats: " << QImageReader::supportedImageFormats();
                                      supported formats: QList("bmp", "pbm", "pgm", "png", "ppm", "xbm", "xpm")

                                      J Offline
                                      J Offline
                                      JoeCFD
                                      wrote on 1 Apr 2025, 12:25 last edited by JoeCFD 4 Jan 2025, 14:05
                                      #18

                                      @Nguyen-Thang-Phong Did you try the following in the pro file?

                                      CONFIG   += static
                                      # For static plugins
                                      static {
                                          # Include the GIF plugin
                                          QTPLUGIN += qgif
                                      }
                                      
                                      N 1 Reply Last reply 2 Apr 2025, 02:54
                                      0
                                      • J JoeCFD
                                        1 Apr 2025, 12:21

                                        @JonB I play a GIF file in a QMovie in a QLabel.

                                        J Offline
                                        J Offline
                                        JonB
                                        wrote on 1 Apr 2025, 12:45 last edited by
                                        #19

                                        @JoeCFD said in How to using GIF image for QT ?:

                                        @JonB I play a GIF file in a QMovie in a QLabel.

                                        I know you do. And I have suggested removing the QMovie level, to eliminate that, by assigning a created QPixmap from a GIF file directly to the QLabel, which can display GIF images, to see if that works. And I have also suggested using an external, actual GIF file instead of one in a Qt resource, and various QFile::exists() checks to verify the file or resource can be found. Up to you whether you do these things, but they check for various problems. It may well be that your issue is static-related and these will not show anything wrong, but it is what I would do before proceeding.

                                        J 1 Reply Last reply 1 Apr 2025, 13:07
                                        0
                                        • J JonB
                                          1 Apr 2025, 12:45

                                          @JoeCFD said in How to using GIF image for QT ?:

                                          @JonB I play a GIF file in a QMovie in a QLabel.

                                          I know you do. And I have suggested removing the QMovie level, to eliminate that, by assigning a created QPixmap from a GIF file directly to the QLabel, which can display GIF images, to see if that works. And I have also suggested using an external, actual GIF file instead of one in a Qt resource, and various QFile::exists() checks to verify the file or resource can be found. Up to you whether you do these things, but they check for various problems. It may well be that your issue is static-related and these will not show anything wrong, but it is what I would do before proceeding.

                                          J Offline
                                          J Offline
                                          JoeCFD
                                          wrote on 1 Apr 2025, 13:07 last edited by
                                          #20

                                          @JonB It is not a QMovie issue. May be better to try to make his code to run dynamically with gif plugin first. And then build his app with gif plugin statically.

                                          J 1 Reply Last reply 1 Apr 2025, 13:14
                                          1

                                          1/23

                                          31 Mar 2025, 08:01

                                          • Login

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