Results 1 to 10 of 10

Thread: Animated GIF Problem

  1. #1
    Join Date
    Nov 2009
    Posts
    39
    Thanks
    9
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Animated GIF Problem

    This one is really giving me a headache. I'm loading an animated gif and setting it as a movie in a QLabel.

    Qt Code:
    1. QMovie *status_gif = new QMovie("status.gif");
    2.  
    3. if (!status_gif->isValid()) {
    4. QMessageBox::information(this, "Error", "This Sucks...");
    5. }
    6.  
    7. status_gif->start();
    8.  
    9. _status_animation = new QLabel();
    10. _status_animation->setMovie(status_gif);
    11. _status_animation->setFixedSize(31,31);
    12. status_layout->addWidget(_status_animation);
    To copy to clipboard, switch view to plain text mode 

    This works great on my machine (the one I wrote the code on), but on any other machine I try, isValid() fails. The file exists in the correct place (current directory), I've checked a hundred times. Any clue as to what could cause a gif not to load?

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Animated GIF Problem

    Quote Originally Posted by MSUdom5 View Post
    Any clue as to what could cause a gif not to load?
    Yes, you forgot to deliver the gif image plugin with your application. (My crystal ball says I am 99,9999% right with that assumption)

  3. The following 2 users say thank you to Lykurg for this useful post:

    MSUdom5 (24th February 2010), ntp (9th December 2011)

  4. #3
    Join Date
    Nov 2009
    Posts
    39
    Thanks
    9
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Animated GIF Problem

    Thanks for the reply. I'm sure you're crystal ball is right, but what's the correct way to deliver this plugin? I'm assuming it's the .\qt\plugins\imageformats\qgif4.dll file. I include this in the directory, but the gif still doesn't load.

  5. #4
    Join Date
    Jan 2009
    Location
    The Netherlands and Spain
    Posts
    150
    Thanks
    6
    Thanked 18 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Animated GIF Problem

    Are you really sure about the current directory?
    Try giving a full absolute path to the gif-file.

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

    MSUdom5 (24th February 2010)

  7. #5
    Join Date
    Nov 2009
    Posts
    39
    Thanks
    9
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Animated GIF Problem

    Thanks boudie. Yeah, I'm sure, and I've tried using an absolute path. I'm convinced it's the plugin issue as Lykurg mentioned. Here's some new info:

    On my development machine, I moved the gif plugin from '\qt\plugins\imageformats' to a new directory called '\qt\plugins\imageformats\temp'. This, of course, causes the gif not to be loaded. However, when I move the plugin dll to the executable directory, the gif still isn't loaded. Where does this plugin dll need to be (relative to the executable directory), in order to be seen?

    I've also tried using 'Application::addLibraryPath()' to force it to look in a certain directory, but that doesn't work either.

  8. #6
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Animated GIF Problem

    Hi, you can find the path informations there: http://doc.trolltech.com/4.6/deployment-windows.html. But to be honest, I am struggle each time with that. So try various directories till it success. As I remember it has to be (root is the application execution directory) \plugins\imageformats\qgif4.dll orsimple \plugins\qgif4.dll

  9. The following user says thank you to Lykurg for this useful post:

    MSUdom5 (24th February 2010)

  10. #7
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Animated GIF Problem

    If your application is in say #APP_DIR#, then you should copy the imageformats folder to #APP_DIR#.
    #APP_DIR#/ImageFormats will be the new location. The gif dll will be inside Imageformats directory as per the structure in qt directory.

  11. The following user says thank you to aamer4yu for this useful post:

    MSUdom5 (24th February 2010)

  12. #8
    Join Date
    Nov 2009
    Posts
    39
    Thanks
    9
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Animated GIF Problem

    aamer4yu, that fixed it! Thanks!

    The documentation didn't seem to explain this very well. Intuitively, I would think the dll should go in $APP_DIR/plugins/imageformats as Lykurg mentioned. Does the required dll location change between Qt releases?

  13. #9
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Animated GIF Problem

    Does the required dll location change between Qt releases?
    I dont think so.

  14. #10
    Join Date
    Dec 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Red face Re: Animated GIF Problem

    Thanks for the post...very helpful..saved lot of time.

Similar Threads

  1. QTreeWidgetItem animated icon
    By ^NyAw^ in forum Qt Programming
    Replies: 1
    Last Post: 10th February 2010, 18:09
  2. Dynamic Animated QLabel
    By patrik08 in forum Qt-based Software
    Replies: 0
    Last Post: 30th May 2008, 18:38
  3. Pb with animated gif on Mac os
    By mourad in forum Qt Programming
    Replies: 0
    Last Post: 17th April 2008, 13:38
  4. Animated Cursor
    By kemp in forum Qt Programming
    Replies: 1
    Last Post: 22nd January 2007, 07:53
  5. animated gif's
    By :db:sStrong in forum Newbie
    Replies: 2
    Last Post: 31st May 2006, 15:22

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.