图标在其他计算机上消失 [英] Icons disappear on an other computer

查看:137
本文介绍了图标在其他计算机上消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Qt Creator创建了一个程序,并使用发布模式进行编译。
我已经添加了所有必要的DLL,一切在我的电脑上运行良好。

I've created a program with Qt Creator and compiled it with the release mode. I've added all the necessary DLLs and everything runs fine on my computer.

问题是,当我从其他计算机启动程序时

The problem is that when I start the program from an other computer all the icons that I've included are not displayed, whereas everything looks fine on my computer.

这是从哪里来的?

编辑:图标加载到qrc文件...

The icons are loaded in a qrc file...

推荐答案

Qt对文件格式的支持插件。为了确保您的应用程序在非开发计算机上部署时能够正常工作,您必须确保您已部署了相关的插件。

Most of Qt's support for file formats relies on plugins. To ensure that your application works as expected when deploying it on non-development machines, you will have to make sure that you have also deployed the relevant plugins. If you haven't, the loading of files (ICO icons in this case) will simply fail silently.

在这种情况下,重要的插件是qico4.dll(如果没有,则加载文件(在这种情况下为ICO图标)你在Windows上)。

The plugin of importance in this case is qico4.dll (if you're on Windows).

官方Qt文档包含有关 Qt部署 Windows Mc 。向下滚动到Qt插件的相关信息。

The official Qt documentation contains all the relevant information on Qt deployment for both Windows and Mac. Scroll down to the relevant information on Qt plugins.

作为一个快速解决方案,您可以创建一个名为 imageformats 包含您的可执行文件的文件夹的子目录,您复制qico4.dll到其中。

As a quick solution you could create a directory named imageformats as a subdirectory of the folder containing your executable, into which you copy the qico4.dll.

(注意:用户 @smerlin 表示这必须 plugins / imageformats 相对于可执行文件目录我似乎记得我的应用程序不需要额外的 plugins 目录,但我会更新我的答案,如果我发现这是真的情况下)。

(Note: user @smerlin says this has to be plugins/imageformats relative to your executable directory. I seem to recall that my applications did not require the extra plugins directory, but I'll update my answer should I find that this is indeed the case).

这篇关于图标在其他计算机上消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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