PDA

View Full Version : Low-level error conditions on QImage.load()



bruccutler
19th January 2007, 16:50
Along a related line as the previous question, I have a 'gif' file (running on Microsoft XP). I can open the file using fopen("filename.gif", "rb"), but when I attempt to load the image using either QImage.load("filename.gif", "GIF") or QPixmap.load("filename.gif", "GIF"), it returns false. Are there any lowerlevel error messages set to help me determine why it wont' load the filename.gif into the image? I can load it into an graphical editor just fine.
- Bruce

jacek
19th January 2007, 17:00
You can use QImageReader class and its error() and errorString() methods.

What does QImageReader::supportedImageFormats() return? Your Qt probably wasn't compiled with GIF support.

bruccutler
19th January 2007, 20:40
How do I compile Qt with GIF support or is that something that TrollTech has to do?

jpn
19th January 2007, 21:09
Try running "configure -help" wherever you Qt is installed to (eg. C:\Qt\4.2.2).

It will show you that the default option for GIF support is "-no-gif". To compile Qt with GIF support turned on, pass "-qt-gif" as a parameter to the configure.

C:\Qt\4.2.2\> configure -qt-gif

Once the configure finishes, you are ready to recompile Qt. Follow the instructions as it depends on the compiler you are using.