Qt jpeg can't work on my friend's PC

故事扮演 提交于 2019-12-20 02:52:34

问题


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:

  1. I copy qjpeg4.dll from C:\QtSDK\QtCreator\bin\imageformats into my app root dir.---->failed.
  2. 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!