问题
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?
回答1:
You have to deploy the Qt DLLs and the plugin directories, see my answer to the question Qt dll deployment on Windows.
来源:https://stackoverflow.com/questions/11500468/qt-jpeg-cant-work-on-my-friends-pc