MAC上的QT/C ++-未设置应用程序图标 [英] QT/C++ on MAC - Application Icon doesn't set

查看:104
本文介绍了MAC上的QT/C ++-未设置应用程序图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力解决的怪异问题.在与我的"* .pro" QT项目文件相同的文件夹中,我有一个Resources/myIcon.png.

Weird problem I'm struggling with. On the same folder as my "*.pro" QT project file I have a Resources/myIcon.png.

我试图将其设置为在OSX上运行的已构建应用程序的图标.我阅读了文档,并建议在.pro文件中放入"ICON =".我这样做了,但是由于某种原因,图标 IS 复制到了应用内容内的resources文件夹中,但是.pfile的icon字段仍然为空.即使我手动将其更改为"resources/myIcon.png",它也无法正常工作.

I am trying to set that as the Icon for my built application, running on OSX. I read the documentation and it suggests to put a "ICON = " in the .pro file. I did that, but for some reason, the icon IS copied over the the resources folder inside my app's content, but the .pfile's icon field remains empty. Even when I change it manually to "resources/myIcon.png" it will not work.

我在做什么错了?

推荐答案

不要在应用程序捆绑包中为Info.plist中的图标文件设置完整路径名.只需设置文件名. Mac OS知道要查找AppName.app/Contents/Resources.

Don't set the full pathname within the application bundle for the icon file in the Info.plist. Just set the filename. Mac OS knows to look in AppName.app/Contents/Resources for it.

是的,据我所知它必须是ICNS文件.您可以使用Mac OS开发工具中的"Icon Composer"实用程序从.png创建.icns.

And yes, it must be an ICNS file as far as I'm aware. You can use the 'Icon Composer' utility that is part of the Mac OS development tools to create an .icns from a .png.

这篇关于MAC上的QT/C ++-未设置应用程序图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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