April 19, 2012

ilgale ilgale
Lab Rat
3 posts

QPixmap fails in release


In my application I use QPixmap to load some Jpeg files that I will show in QLabels.

It works fine when I run my application in debug, but, when I recompile it in Release and I run the release executable manually or by QtCreator, QPixmap fails loadind jpeg file.

I’ve seen someone suggests to copy the imageformats folder (with all dlls) in the same folder of the executable file but it doesn’t work !

Is there something I have to do in my source code ? I simply do that (and in debug works fine):

  1. QPixmap l_Pixmap;
  2. bool l_boResult;
  3. l_boResult = l_Pixmap.load("C:\\Users\\Administrator\\Desktop\\Exe\\Labels\\3.jpg");

but I’ve seen someone loads plug-ins directly in the source cose…

Are there other trick to be used ?

Thanks a lot !!!

[Edit: Added @ tags; mlong]

1 reply

April 20, 2012

rschaub rschaub
Lab Rat
33 posts

you can use

  1. QList<QByteArray> QImageReader::supportedImageFormats () [static]

to determine whether the necessary plugins have been loaded. You can print the result in a console or message box and you’ll at least find out if there’s a problem loading the image formats plugins.

  ‹‹ Unhandled Exception using QGLFunctions on Release mode only      Qt SDK doesn’t pick up native widgets in Kubuntu ››

You must log in to post a reply. Not a member yet? Register here!