2012-03-01 272 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。