I have a Qt application that has some embedded JPG files that I want to display. When I compile and run both the debug and release versions on my machine, everything works perfectly. When I copy the application to a thumb drive and run it from there on my machine, it works fine. On the thumb drive and another developer's machine: OK. On the thumb drive on a third, non-developer's machine: no images!
proj.pri
RESOURCES += ./proj.qrc
proj.qrc:
<RCC>
<qresource prefix="/myApp">
<file>Gui/Resources/logo.jpg</file>
<file>Gui/Resources/another_image.jpg</file>
</qresource>
</RCC>
main.cpp:
{
...
QImage *logo = new QImage( ":/myApp/Gui/Resources/logo.jpg" );
QImage *image = new QImage( ":/myApp/Gui/Resources/another_image.jpg" );
myClass *d1 = new myClass( "Some Text", 48, 30, logo );
myClass *d2 = new myClass( "Some More Text", 48, 30, another_image );
...
}
I have confirmed that the images are being added to the executable by commenting out the RESOURCES line in the .pri file. The size of the binary drops by the size of the images plus a bit; when I run the application, the images do not appear. I un-comment the RESOURCES line and everything works as described above.
What am I missing here? A DLL on the non-developer's machine? A
Environment:
It needs jpeg plugin to load images. If you have Qt installed they would be in %QTDIR%\plugins\imageformats.
Copy qjpeg4.dll into plugin folder on your thumb drive.
root/app.exe
root/qt.conf
root/plugins/imageformats/qjpeg4.dll
In qt.conf file set path to your plugins dir:
[Paths]
plugins=./plugins
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With