5

As described in the Qt-Documentation I have created my icon file with the icon-composer. Then I have inserted in my .pro-file the following line.

ICON = 3D_Modell.icns

While compiling I get the following error:

No rule to make target `../3D', needed by `3D_Modell.app/Contents/Resources/3D_Modell.icns'

Where is the Contents/Resources folder? Where exactly do I put the icns-file. I have put it into the folder where my project and all cpp and h files lie.

Miss Marple
  • 149
  • 2
  • 4
  • 12

3 Answers3

5

All we have in our .pro file is:

macx:ICON = $${PWD}/my_app.icns

The icon is in the same directory as the .pro file. No manual steps are necessary.

Dave Mateer
  • 17,608
  • 15
  • 96
  • 149
  • Additionally, I use QMAKE_INFO_PLIST = Info.plist line and I need to add manually CFBundleIconFile AppIcon values to the info.plist file. – Volkan Ozyilmaz May 23 '17 at 11:43
1

The instructions suggest you can add the icon manually:

  1. Create an Info.plist file for your application (using the PropertyListEditor, found in Developer/Applications).
  2. Associate your .icns record with the CFBundleIconFile record in the Info.plist file (again, using the PropertyListEditor).
  3. Copy the Info.plist file into your application bundle's Contents directory.
  4. Copy the .icns file into your application bundle's Contents/Resources directory.

To get access to your application bundle from the finder, right-click on your application and select 'show package contents' from the context menu. This will open a new finder window from which you can navigate to /Contents/Resources/.

Hope this helps.

EDIT:

The PropertyListEditor utility is in Developer/Applications/Utilities/. You can use it to "open" your application bundle, and edit the plist (located in the bundle's /Contents/ folder). The CFBundleIconFile item is helpfully called Icon File in the editor, but if you select View > Show Raw Keys/Values you can see the actual property names.

enter image description here

Richard Inglis
  • 5,888
  • 2
  • 33
  • 37
  • Thank you for your help. I am trying to follow the steps, but the I dont understand the second step. How do I associate my icns.record with CFBundleIconFile. Where do i find this CFBundleIconFile. – Miss Marple Mar 01 '12 at 12:20
  • If this solved your problem, please consider accepting my answer (by clicking on the big tick-mark), thanks. – Richard Inglis Mar 01 '12 at 12:54
  • If you are using `qmake`, as is the normal Qt build process, the manual steps should be unnecessary. – Dave Mateer Mar 01 '12 at 13:17
  • Thank you its working. I thought that I also needed to add the line ICON = xxxx.icns into the pro. But it isnt necessary, when creating the icon with plist. Thanks again. – Miss Marple Mar 01 '12 at 13:38
  • in qt creator 4.2.1 & Qt 5.8 this work for me: 1. remove the build folder with finder, 2. in .pro as usual ICON=myapp.icns and build, it's important to first remove the complete folder. – roberto May 25 '17 at 12:16
0

Sounds like an issue with the icon name. Try Modell.icns instead.

Timmmm
  • 88,195
  • 71
  • 364
  • 509