qticon只显示在我的电脑上 [英] qticon only showing on my pc

查看:117
本文介绍了qticon只显示在我的电脑上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在托盘栏中创建了一个带有qt图标的应用程序,这是我创建图标的方式;

i made an app in the tray bar with an icon with qt, this is the way i make the icon;

trayIcon->setIcon(QIcon("favicon.ico"));

但它只显示我的电脑上的图标,当我给项目给别人,它的只是看不见。
即使我做了下一件事情;

but it only show the icon on my pc, when i give the project to somebody else its just invisible. even if i do the next thing;

trayIcon->setIcon(QIcon(QDir::currentPath() + "/favicon.ico"));

有人知道这个问题吗? /如何解决呢? THNX !!!

does somebody know this problem? / how to solve it? THNX!!!

推荐答案

您确定已将favicon.ico部署到其他电脑上吗?我建议你把favicon.ico文件到资源文件。 有关Qt资源系统的详情

Are you sure you have deployed the favicon.ico to the other computers? I recommend that you put the favicon.ico file to the resource file. More information about Qt resource system.

如果你想保持图标作为一个单独的文件,你可以尝试改变QDir :: currentPath()QApplication :: applicationDirPath()。当前路径可能不是这些其他计算机中的应用程序路径。

If you want to keep the icon as a separate file, you could try to change QDir::currentPath() to QApplication::applicationDirPath(). The current path might not be the application path in those other computers.

这篇关于qticon只显示在我的电脑上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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