I am finishing a Qt app, but I encounted a problem. Here is it:
I use this code to load image into a QGraphicsScene:
QFile file(fileName);
if(file.open(QFile::ReadOnly)){
QByteArray data=file.readAll ();
pixmapItem.loadFromData (data,"jpeg");
}
It works on my computer, but when I give this app to my friend, he just can’t show this image. I Googled and searched Stack Overflow about this issue, which sounds like I need jpeg plugins.
So, I do this:
- I copy qjpeg4.dll from C:\QtSDK\QtCreator\bin\imageformats into my app root dir.—->failed.
- I copy entire imageformats directory as a subdirectory of my app toor dir. —->also failed.
So, how can I distribute my app to my friends? It works in my computer, so, it can do work on others’, can’t it?
You have to deploy the Qt DLLs and the plugin directories, see my answer to the question Qt dll deployment on Windows.