[Interest] error setting app icon on OS X

Till Oliver Knoll till.oliver.knoll at gmail.com
Mon Jul 7 09:59:32 CEST 2014


Am 07.07.2014 um 09:17 schrieb Freddy Martinez Garcia <freddy311082 at gmail.com>:

> ...
> 
> I had generate a XCode project to put there my icons and it doesn't work...

Just to clarify: are you now using qmake or Xcode (possibly generated from a *.pro file)?

What is your tool of choice?


>   app.setWindowIcon(QIcon("://adviser.icns"));

This probably does not do what you think it does: while it is maybe possible for Qt to read *.icns (a OS X specific format for "desktop icons") images IF you have the proper QImage plugin available and /deployed/ (in the proper image Qt plugin folder -> Qt docs about deploying plugins) it would /not/ set the /desktop/ icon!

And since you referenced the Qt docs about setting the /desktop/ icon (aka "application icon") I assume that this is really what you want.

(The above code would set the icon for the application /window/ at runtime, but here you probably want to use a *.png file instead!)

> and I had added to mi .pro this line:
> 
> ICON = adviser.icns

This however looks fine and should set the /desktop/ icon (the one users would see in the Application folder and double-click on etc.), assuming again that you build with qmake/make (possibly triggered from within QtCreator).

And that is what I would check:

* is the relative path to adviser.icns correct?
* Is your *.icns file a valid one (does it show properly in e.g. "Preview")?
* Is the file really copied into the proper Resource folder in the app bundle when building?
* Are you using a custom Info.plist file? If so, do you have a corresponding CFBundleIconFile entry?
* If no custom Info: is the Info.plist properly generated and placed into the bundle?


Cheers,
  Oliver

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140707/4754c8fa/attachment.html>


More information about the Interest mailing list