Qt jpeg无法在我朋友的PC上运行 [英] Qt jpeg can't work on my friend's PC

查看:225
本文介绍了Qt jpeg无法在我朋友的PC上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在完成一个Qt应用程序,但我遇到了一个问题。这是它:

I am finishing a Qt app, but I encounted a problem. Here is it:

我使用此代码将图像加载到QGraphicsScene中:

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");
        }

它可以在我的电脑上运行,但是当我把这个应用程序交给我的朋友时,他只是无法展示这个形象。我用Google搜索并搜索了Stack Overflow这个问题,听起来我需要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.

所以,我这样做:


  1. 我从C复制qjpeg4.dll :\ QtSDK \ QtCreator \ bin \ image格式到我的应用程序根目录.---->失败。

  2. 我将整个imageformats目录复制为我的app toor dir的子目录。 ---->也失败了。

那么,我怎样才能将我的应用发布给我的朋友?它可以在我的计算机上运行,​​因此,它可以对别人起作用,不是吗?

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?

推荐答案

你必须部署Qt DLL和插件目录,请参阅我对在Windows上部署Qt dll的问题的回答

You have to deploy the Qt DLLs and the plugin directories, see my answer to the question Qt dll deployment on Windows.

这篇关于Qt jpeg无法在我朋友的PC上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆