c++托盘中的图标
我用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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我假设您忘记提供图标和可执行文件。但无论如何,最好将图标作为资源嵌入到可执行文件中。
查看 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.