QT/C++ on MAC - Application Icon doesn't set
Weird problem I'm struggling with. On the same folder as my "*.pro" QT project file I have a 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 开发者_StackOverflow中文版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.
What am I doing wrong?
Manually delete the generated app bundle. Run QMake
followed by Rebuild All
is not sufficient!
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.
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.
Are you referring to the icon which appears in the dock? I added a .ico to my application's resource file, then set it as my icon with the following call
QApplication::qApp()->setWindowIcon(QIcon(<resource path>));
精彩评论