關(guān)于Qt 圖標修改實例
本文介紹的是關(guān)于Qt 圖標的修改的方法,對于圖標,相信大家都很希望自己對應(yīng)用程序里面都是很好看的圖標吧,如果你不怎么會的話,就參考胰腺癌本章吧!
在Qt助手(assistant.exe)搜索關(guān)鍵字"Setting the Application Icon"就可以看到在各種平臺設(shè)置Qt程序圖標的方法。
最近經(jīng)常在windows寫qt程序。編譯完的qt程序圖標是windows默認的應(yīng)用程序圖標,不好看。于是就想給它換一個,找了一下qt的幫助文檔,里面有提到這個問題。方法也挺簡單的:
首先當然要有一個圖標了,呵呵。把這個圖標復(fù)制到程序的主目錄下,姑且名字叫”myicon.ico”吧。沒有?可以自己用vc畫一個。然后編寫一個icon.rc文件。里面只有一行文字:
- IDI_ICON1 ICON “myicon.ico”
***,在工程的pro文件里加入一行:
- RC_FILE = icon.rc
qmake和make一下,就可以發(fā)現(xiàn)你的應(yīng)用程序擁有漂亮的圖標了。
- 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
小結(jié):Qt 圖標修改就介紹到這里,希望有幫助到你哦!你的默認圖標修改好了嗎?還有什么藥幫忙的,也可以留言!
【編輯推薦】