2012-03-01 271 views
2

正如Qt-Documentation中所述,我使用图标编辑器创建了我的图标文件。然后我在我的.pro文件中插入以下行。使用Qt在Mac上设置图标

ICON = 3D_Modell.icns 

在编译时,我得到以下错误:

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

哪里是内容/资源文件夹? 我到底在哪里放icns文件。我把它放到我的项目和所有cpp和h文件所在的文件夹中。

回答

1

instructions建议你可以手动添加图标:

  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.

要访问从取景器的应用程序包,您的应用程序右键单击并选择“显示包内容”从上下文菜单。这将打开一个新的查找窗口,您可以从中导航到/Contents/Resources/

希望这会有所帮助。

编辑:

的PropertyListEditor效用是在Developer/Applications/Utilities/。您可以使用它来“打开”您的应用程序包,并编辑plist(位于软件包的/Contents/文件夹中)。在编辑器中CFBundleIconFile项目有用地称为Icon File,但如果选择查看>显示原始键/值,则可以看到实际的属性名称。

enter image description here

+0

谢谢你的帮助。我试图按照步骤行事,但我不明白第二步。我如何将我的icns.record与CFBundleIconFile相关联。我在哪里可以找到这个CFBundleIconFile。 – 2012-03-01 12:20:55

+0

我在上面的答案中添加了一些以帮助步骤1和2 ... – 2012-03-01 12:41:41

+0

如果这解决了您的问题,请考虑接受我的答案(通过点击大号刻度),谢谢。 – 2012-03-01 12:54:03

3

所有我们在我们的.pro文件是:

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

的图标是在同一目录中.pro文件。没有手动步骤是必要的。

+0

此外,我使用QMAKE_INFO_PLIST = Info.plist行,我需要手动添加 CFBundleIconFile AppIcon值info.plist文件。 – 2017-05-23 11:43:36

0

听起来像图标名称的问题。请尝试使用Modell.icns。