Results 1 to 17 of 17

Thread: QMake and GIF Support

  1. #1
    Join Date
    Jan 2009
    Posts
    53
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default QMake and GIF Support

    Hi,

    I'm using Qt 4.5.1 for Windows. How do I enable *.gif file animation on Qt?

    I did opened Qt 4.5.1 Command Prompt, enter configure -platform win32-msvc2005 -qt-gif to compile the plugin for GIF reading support.

    Should I use nmake again after the step above?

    How do I verify that the Qt libraries has *.gif file support enabled?

    Thanks in advance.

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QMake and GIF Support

    just see if plugins/imageformats dir contains the gif dll.

  3. The following user says thank you to nish for this useful post:

    sheeeng (27th July 2009)

  4. #3
    Join Date
    Jan 2009
    Posts
    53
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMake and GIF Support

    Quote Originally Posted by MrDeath View Post
    just see if plugins/imageformats dir contains the gif dll.
    I did a quick look at the directory that you have mentioned. The related files exist even before i did the rebuild too.

    Qt Code:
    1. C:\Qt\4.5.1\plugins\imageformats>dir *gif*
    2.  
    3. Directory of C:\Qt\4.5.1\plugins\imageformats
    4.  
    5. 07/24/2009 06:16 PM 21,504 qgif4.dll
    6. 07/24/2009 06:16 PM 382 qgif4.dll.manifest
    7. 07/24/2009 06:16 PM 719 qgif4.exp
    8. 07/24/2009 06:16 PM 2,022 qgif4.lib
    9. 07/24/2009 06:16 PM 502,784 qgif4.pdb
    10. 07/24/2009 06:16 PM 54,272 qgifd4.dll
    11. 07/24/2009 06:16 PM 387 qgifd4.dll.manifest
    12. 07/24/2009 06:16 PM 720 qgifd4.exp
    13. 07/24/2009 06:16 PM 450,740 qgifd4.ilk
    14. 07/24/2009 06:16 PM 2,036 qgifd4.lib
    15. 07/24/2009 06:16 PM 551,936 qgifd4.pdb
    16. 11 File(s) 1,587,502 bytes
    To copy to clipboard, switch view to plain text mode 

    Is this what we are looking for?

    Thanks in advance.

  5. #4
    Join Date
    May 2009
    Posts
    147
    Thanks
    11
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMake and GIF Support

    http://doc.trolltech.com/4.5/qmovie.html

    Qt Code:
    1. QLabel label;
    2. QMovie *movie = new QMovie("animations/fire.gif");
    3. label.setMovie(movie);
    4. movie->start();
    To copy to clipboard, switch view to plain text mode 
    HTH

  6. The following user says thank you to FS Lover for this useful post:

    sheeeng (27th July 2009)

  7. #5
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QMake and GIF Support

    Quote Originally Posted by sheeeng View Post
    I did a quick look at the directory that you have mentioned. The related files exist even before i did the rebuild too.

    Qt Code:
    1. C:\Qt\4.5.1\plugins\imageformats>dir *gif*
    2.  
    3. Directory of C:\Qt\4.5.1\plugins\imageformats
    4.  
    5. 07/24/2009 06:16 PM 21,504 qgif4.dll
    6. 07/24/2009 06:16 PM 382 qgif4.dll.manifest
    7. 07/24/2009 06:16 PM 719 qgif4.exp
    8. 07/24/2009 06:16 PM 2,022 qgif4.lib
    9. 07/24/2009 06:16 PM 502,784 qgif4.pdb
    10. 07/24/2009 06:16 PM 54,272 qgifd4.dll
    11. 07/24/2009 06:16 PM 387 qgifd4.dll.manifest
    12. 07/24/2009 06:16 PM 720 qgifd4.exp
    13. 07/24/2009 06:16 PM 450,740 qgifd4.ilk
    14. 07/24/2009 06:16 PM 2,036 qgifd4.lib
    15. 07/24/2009 06:16 PM 551,936 qgifd4.pdb
    16. 11 File(s) 1,587,502 bytes
    To copy to clipboard, switch view to plain text mode 

    Is this what we are looking for?

    Thanks in advance.
    you have gif brother!!!

  8. #6
    Join Date
    Jan 2009
    Posts
    53
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMake and GIF Support

    Quote Originally Posted by FS Lover View Post
    http://doc.trolltech.com/4.5/qmovie.html

    Qt Code:
    1. QLabel label;
    2. QMovie *movie = new QMovie("animations/fire.gif");
    3. label.setMovie(movie);
    4. movie->start();
    To copy to clipboard, switch view to plain text mode 
    HTH
    @FS Lover, Thanks for the tips. Btw, does FS mean anything to you?

    Could I just set the QLabel in Qt Designer to a *.gif file and run it? I do not really want to use that in the code as the *.gif is always shown.

    Quote Originally Posted by MrDeath View Post
    you have gif brother!!!
    @MrDeath, I know. I did actually noticed these files in my folders even BEFORE I did a rebuild and configure with *.gif file support.

    Putting a *.gif file in a QLabel under Qt Designer in preview does not work.

  9. #7
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QMake and GIF Support

    you have to use QMovie class... cant set gif directly

  10. #8
    Join Date
    Jan 2009
    Posts
    53
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMake and GIF Support

    Quote Originally Posted by MrDeath View Post
    you have to use QMovie class... cant set gif directly
    It should have been easier to just put the *.gif file in the QLabel and render it automatically.

    Thanks @MrDeath for the hint. Any tricks to automate the *.gif file rendering in QLabel?

    Thank in advance.

  11. #9
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QMake and GIF Support

    unfortunately qlabel can only display static images.... QMovies provides the frames of gif image one by one to qlabel ... the best you can do is to make a subclass of QLabel and handle QMovie inside it... but it is not worth the effort.

  12. The following user says thank you to nish for this useful post:

    sheeeng (27th July 2009)

  13. #10
    Join Date
    Jan 2009
    Posts
    53
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMake and GIF Support

    Quote Originally Posted by MrDeath View Post
    unfortunately qlabel can only display static images.... QMovies provides the frames of gif image one by one to qlabel ... the best you can do is to make a subclass of QLabel and handle QMovie inside it... but it is not worth the effort.
    @MrDeath, thanks for the explanation. I guess we have to manually start the *.gif file animation manually.

  14. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QMake and GIF Support

    Actually the label should display the first frame of the animation when fed with an animated gif (without going through QMovie).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  15. The following user says thank you to wysota for this useful post:

    sheeeng (27th July 2009)

  16. #12
    Join Date
    Jan 2009
    Posts
    53
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMake and GIF Support

    Quote Originally Posted by wysota View Post
    Actually the label should display the first frame of the animation when fed with an animated gif (without going through QMovie).
    Thanks, wysota. You made the point clearer now.

  17. #13
    Join Date
    Jan 2009
    Posts
    53
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMake and GIF Support

    Quote Originally Posted by MrDeath View Post
    unfortunately qlabel can only display static images.... QMovies provides the frames of gif image one by one to qlabel ... the best you can do is to make a subclass of QLabel and handle QMovie inside it... but it is not worth the effort.
    Hi @MrDeath, I tried to encapsulate the QMovie inside the QLabel. However, I do faced some obstacles.

    The QLabel does not have the file name to QPixmap, which is necessary for the QMovie to work.

    QMovie has three constructors listed below.
    Qt Code:
    1. QMovie ( QObject * parent = 0 )
    2. QMovie ( QIODevice * device, const QByteArray & format = QByteArray(), QObject * parent = 0 )
    3. QMovie ( const QString & fileName, const QByteArray & format = QByteArray(), QObject * parent = 0 )
    To copy to clipboard, switch view to plain text mode 

    Any hints on using the pixmap property from QLabel for QMovie?

    Thanks in advance.

  18. #14
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QMake and GIF Support

    if you are thinking that you can adjust the property in qt desiner that forget about it.. ...

    and if you want the file name then you can just add one more member to your class as

    QString filename;
    void setFile(QString filename);

    and pass it to Qmovie

  19. The following user says thank you to nish for this useful post:

    sheeeng (28th July 2009)

  20. #15
    Join Date
    Jan 2009
    Posts
    53
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMake and GIF Support

    Quote Originally Posted by MrDeath View Post
    if you are thinking that you can adjust the property in qt desiner that forget about it.. ...

    and if you want the file name then you can just add one more member to your class as

    QString filename;
    void setFile(QString filename);

    and pass it to Qmovie
    @MrDeath, thanks a lot for the hint! Got it!

  21. #16
    Join Date
    May 2009
    Posts
    147
    Thanks
    11
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMake and GIF Support

    Quote Originally Posted by sheeeng View Post
    @FS Lover, Thanks for the tips. Btw, does FS mean anything to you?
    FS means `Free Software' to me.

  22. #17
    Join Date
    Jan 2009
    Posts
    53
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMake and GIF Support

    Quote Originally Posted by FS Lover View Post
    FS means `Free Software' to me.
    Thanks for the explanation. Although it is unrelated to this thread.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.