PDA

View Full Version : Gifs don't load in QTextEdit under windows



balazsbela
25th August 2008, 20:36
My project uses a similar method in animating gif images in a QTextEdit to this example: http://wiki.qtcentre.org/index.php?title=Animation_in_QTextEdit

The difference is that I had to load many gif images, so instead of calling setLineWrapColumnOrWidth(lineWrapColumnOrWidth()); to reload the QTextEdit document in every animation I declared a slot and connected it to a QTimer.

It works great under my linux, and it also works under my windows.I have Qt 4.4.1 installed.The problem is that if I send my app to a windows user who doesn't have qt4 installed (not sure about this, maybe doesn't have some other dll) the gifs won't load.White image icons appear instead of animations.
The problem occurs only in the case of gifs.Pngs load perfectly.

I convinced one of my friends to run the app with gdb to see if he gets any errors about missing dlls or other things that could point me in the right direction, but none were found.

I also tried loading it statically with Q_IMPORT_PLUGIN(qgif) (added QTPLUGIN += qgif to the project file too), but it complained about not finding qgif.I do have libqgif.a and qgif4.dll in plugins/imageformats, as part of Qt 4.4.1.

I copied to the folder containing the exe file of my app the following dlls:
mingw10.dll, QtCore4.dll, QtGui4.dll,QtNetwork4.dll.
Every windows user who tested the app runs XP, haven't tried under vista.

What am I doing wrong?
Thanks.

aamer4yu
26th August 2008, 10:31
Did you try copying the gif lib/dll into ur application directory ?
Qt doesnt support gif directly but uses plugins for that.
You can find the necessary dlls under QT_Direcory/4.x.y/plugins/imageformats directory.
Hope this will solve ur problem :)

balazsbela
26th August 2008, 13:01
Did you try copying the gif lib/dll into ur application directory ?
Qt doesnt support gif directly but uses plugins for that.
You can find the necessary dlls under QT_Direcory/4.x.y/plugins/imageformats directory.
Hope this will solve ur problem :)

Yes I did.
I copied libqgif4.a and qgif4.dll in the folder where the exe is.
I'll try making a plugins/imageformats directory tree in my application's folder, and copying them there.

Anyway, thanks for replying.

balazsbela
26th August 2008, 13:29
I was able to reproduce the problem with running my app in Wine.
I tried copying those dlls into both places.
No results.No errors.The gifs simply don't load.
I made sure the paths were right, the gif images are stored in resources.
And both versions were compiled with the same qrc file.

Any ideas ? :confused:

balazsbela
26th August 2008, 22:28
I hate triple posting but I figured it out.
It works now.
I added QCoreApplication::addLibraryPath("."); to main.cpp and made an imageformats subdirectory in the application folder, where I copied the two plugins: libgif4.a and qgif4.dll.

It works.Thanks.