PDA

View Full Version : QMake and GIF Support



sheeeng
27th July 2009, 04:42
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.

nish
27th July 2009, 04:51
just see if plugins/imageformats dir contains the gif dll.

sheeeng
27th July 2009, 04:59
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.


C:\Qt\4.5.1\plugins\imageformats>dir *gif*

Directory of C:\Qt\4.5.1\plugins\imageformats

07/24/2009 06:16 PM 21,504 qgif4.dll
07/24/2009 06:16 PM 382 qgif4.dll.manifest
07/24/2009 06:16 PM 719 qgif4.exp
07/24/2009 06:16 PM 2,022 qgif4.lib
07/24/2009 06:16 PM 502,784 qgif4.pdb
07/24/2009 06:16 PM 54,272 qgifd4.dll
07/24/2009 06:16 PM 387 qgifd4.dll.manifest
07/24/2009 06:16 PM 720 qgifd4.exp
07/24/2009 06:16 PM 450,740 qgifd4.ilk
07/24/2009 06:16 PM 2,036 qgifd4.lib
07/24/2009 06:16 PM 551,936 qgifd4.pdb
11 File(s) 1,587,502 bytes

Is this what we are looking for?

Thanks in advance.

FS Lover
27th July 2009, 05:45
http://doc.trolltech.com/4.5/qmovie.html



QLabel label;
QMovie *movie = new QMovie("animations/fire.gif");
label.setMovie(movie);
movie->start();

HTH

nish
27th July 2009, 05:49
I did a quick look at the directory that you have mentioned. The related files exist even before i did the rebuild too.


C:\Qt\4.5.1\plugins\imageformats>dir *gif*

Directory of C:\Qt\4.5.1\plugins\imageformats

07/24/2009 06:16 PM 21,504 qgif4.dll
07/24/2009 06:16 PM 382 qgif4.dll.manifest
07/24/2009 06:16 PM 719 qgif4.exp
07/24/2009 06:16 PM 2,022 qgif4.lib
07/24/2009 06:16 PM 502,784 qgif4.pdb
07/24/2009 06:16 PM 54,272 qgifd4.dll
07/24/2009 06:16 PM 387 qgifd4.dll.manifest
07/24/2009 06:16 PM 720 qgifd4.exp
07/24/2009 06:16 PM 450,740 qgifd4.ilk
07/24/2009 06:16 PM 2,036 qgifd4.lib
07/24/2009 06:16 PM 551,936 qgifd4.pdb
11 File(s) 1,587,502 bytes

Is this what we are looking for?

Thanks in advance.

you have gif brother!!!

sheeeng
27th July 2009, 06:26
http://doc.trolltech.com/4.5/qmovie.html



QLabel label;
QMovie *movie = new QMovie("animations/fire.gif");
label.setMovie(movie);
movie->start();

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.


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.

nish
27th July 2009, 06:48
you have to use QMovie class... cant set gif directly

sheeeng
27th July 2009, 07:00
you have to use QMovie class... cant set gif directly

:crying: 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.

nish
27th July 2009, 07:04
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.

sheeeng
27th July 2009, 08:00
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.

wysota
27th July 2009, 09:41
Actually the label should display the first frame of the animation when fed with an animated gif (without going through QMovie).

sheeeng
27th July 2009, 09:43
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. :)

sheeeng
28th July 2009, 06:26
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.

QMovie ( QObject * parent = 0 )
QMovie ( QIODevice * device, const QByteArray & format = QByteArray(), QObject * parent = 0 )
QMovie ( const QString & fileName, const QByteArray & format = QByteArray(), QObject * parent = 0 )

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

Thanks in advance.

nish
28th July 2009, 06:47
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

sheeeng
28th July 2009, 06:56
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!

FS Lover
28th July 2009, 10:47
@FS Lover, Thanks for the tips. Btw, does FS mean anything to you?

FS means `Free Software' to me.

sheeeng
28th July 2009, 10:49
FS means `Free Software' to me.

Thanks for the explanation. Although it is unrelated to this thread.