c++托盘中的图标

发布于 2024-09-08 19:19:46 字数 371 浏览 2 评论 0原文

我用qt在托盘中制作了一个应用程序。在我的电脑上,这是一个很好的项目,我在托盘栏中看到了该图标,但是当我将其释放给其他人时,他们看不到该图标,它只是一个可以使用的隐形方块,但它不显示图标。但在我的电脑上它显示了图标。 :我知道这听起来很奇怪,但有人知道如何解决吗?或者如何在资源文件中设置托盘栏图标?

this->setWindowIcon(QIcon("favicon.ico"));
a.start();
createActions();
createTrayIcon();
trayIcon->setIcon(QIcon("favicon.ico"));
trayIcon->setVisible(true);
trayIcon->show();

i used qt to make an application in the tray. on my pc its a good project and i see the icon in the traybar, but when i release it to give it to sombody else they dont see the icon, its just an invissible square that can be used but it dont show the icon. but on my pc it shows the icon. :S i know it sounds weird but does anybody know how to solve it? or how to set the traybar icon in the resource file?

this->setWindowIcon(QIcon("favicon.ico"));
a.start();
createActions();
createTrayIcon();
trayIcon->setIcon(QIcon("favicon.ico"));
trayIcon->setVisible(true);
trayIcon->show();

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沉鱼一梦 2024-09-15 19:19:46

好吧,我假设您忘记提供图标和可执行文件。但无论如何,最好将图标作为资源嵌入到可执行文件中。
查看 Qt 资源文档。基本上,您只需要创建一个资源文件,添加图标,然后将文件名更改为“:/favicon.ico”。通过在文件名前面添加“:/”,Qt 知道从嵌入式资源加载该文件。

Well, I assume that you forgot to provide the icon together with the executable. But in any case, it would be better to embed the icon as resource in the executable.
Have a look at the Qt resource documentation. Basically, you just need to create a resource file, add the icon and then change the filename to something like this ":/favicon.ico". By adding the ":/" in front of the filename, Qt knows to load this from the embedded resources.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文