PDA

View Full Version : QPainter.drawImage() not working with resource image file



thiagoalencar22
22nd April 2010, 15:50
It works fine in the development machine, but in other computers the image doesn't show up. I have also tried using drawPixmap() but the behaviour is the same. Shouldn't the resource be embedded in the executable?

I"ve tried debug and release compilations but both presents this "problem". Ideas?

Lykurg
22nd April 2010, 16:35
Let me guess: you are using jpg files. You have to deploy the right jpg plugin with our application. See the docs on how to deploy an application.

thiagoalencar22
22nd April 2010, 18:29
Thanks Lykurg for pointing me to the right direction!

Actually I had tried different file formats before but the problem persisted, but I never realized I would need to change anything to use a functionality available from Qt's libraries itself.

What I would always do is simply copy the DLLs needed by the executable and it always worked fine, for example, simply copying the "libmySQL.dll and QtSQl4.dll" to the same folder as the executable is enough to make the sql calls work (I never used plugins before). Why is it different with the drawImage() function?

We have more than one Qt executables here so I don't think compiling as stand-alone(static linking) would be a good choice. Do you have any specific recommendations?

Greetings from Brazil!
Thiago

thiagoalencar22
22nd April 2010, 21:00
Got it working now. I didn't change anything - simply copied the respective plugin dll which was missing.
Thank you!

Lykurg
22nd April 2010, 21:07
Well, the jpeg plugin works exactly like the sql one. Just copy the jpeg dll (sorry don't know the right file name since I am now on my linux computer) to your executable (or in the subdirectory imageformats). It's a little bit confusing but a "Qt plugin" is an ordinary library. So you don't have to compile statically.

And the problem is, that the sdk dll's have build in png support but no jpeg. If you don't want do deliver also the jpeg plugin you can also rebuild Qt and activate build-in jpeg support (-qt-libjpeg).

EDIT: Ah, you get it to work! Then I was too late...