關于Qt 圖標修改實例
本文介紹的是關于Qt 圖標的修改的方法,對于圖標,相信大家都很希望自己對應用程序里面都是很好看的圖標吧,如果你不怎么會的話,就參考胰腺癌本章吧!
在Qt助手(assistant.exe)搜索關鍵字"Setting the Application Icon"就可以看到在各種平臺設置Qt程序圖標的方法。
最近經常在windows寫qt程序。編譯完的qt程序圖標是windows默認的應用程序圖標,不好看。于是就想給它換一個,找了一下qt的幫助文檔,里面有提到這個問題。方法也挺簡單的:
首先當然要有一個圖標了,呵呵。把這個圖標復制到程序的主目錄下,姑且名字叫”myicon.ico”吧。沒有?可以自己用vc畫一個。然后編寫一個icon.rc文件。里面只有一行文字:
- IDI_ICON1 ICON “myicon.ico”
***,在工程的pro文件里加入一行:
- RC_FILE = icon.rc
qmake和make一下,就可以發現你的應用程序擁有漂亮的圖標了。
- Store the ICO file in your application's source code directory, for example, with the name myappico.ico. Then,
- create a text file called, say, myapp.rc in which you put a single line of text:
- IDI_ICON1 ICON DISCARDABLE "myappico.ico"
- Finally, assuming you are using qmake to generate your makefiles, add this line to your myapp.pro file:
- RC_FILE = myapp.rc
- Regenerate your makefile and your application. The .exe file will now be represented with your icon in Explorer
小結:Qt 圖標修改就介紹到這里,希望有幫助到你哦!你的默認圖標修改好了嗎?還有什么藥幫忙的,也可以留言!
【編輯推薦】