但還是有需要在info.plist內加入額外的內容, 比如說Retina display的支援(NSHighResolutionCapable), 預設並沒有, 因此還是有需要做自訂的info.plist
作法並不難, 在專案檔(通常是 xxxx.pro)內加入下面的內容:
mac {QMAKE_INFO_PLIST = XXXX.plist}
mac {}內指得是, 這些內容只有針對mac os才有效, 而XXXX.plist則是你的Info.plist的範本檔名, 這個檔跟專案檔放在同一個目錄
XXXX.plist的內容則像這樣:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> | |
<plist version="0.9"> | |
<dict> | |
<key>CFBundleIconFile</key> | |
<string>@ICON@</string> | |
<key>CFBundlePackageType</key> | |
<string>APPL</string> | |
<key>CFBundleGetInfoString</key> | |
<string>Created by Qt/QMake</string> | |
<key>CFBundleSignature</key> | |
<string>@TYPEINFO@</string> | |
<key>CFBundleExecutable</key> | |
<string>@EXECUTABLE@</string> | |
<key>CFBundleIdentifier</key> | |
<string>com.yourcompany.@EXECUTABLE@</string> | |
<key>NOTE</key> | |
<string>This file was generated by Qt/QMake.</string> | |
<key>NSHighResolutionCapable</key> | |
<true/> | |
</dict> | |
</plist> |
跟一般的Info.plist其實是一樣的, 我在這範例裡面加上了"NSHighResolutionCapable", 其餘都跟原先自動產生的內容是差不多的, 除了幾個關鍵內容用變數取代, 這邊變數都是以"@"包起來的, 比如說"@ICON@"就是應用程式的圖示
重新做一次qmake後, 下次編譯的Info.plist便會以這個檔案為範本產生了