Windows下的.exe可执行文件的属性中有图标和版本这两个信息。对于qt程序,要含有这样的信息,那就请如下操作:
新建???.rc文件,在rc文件填入下的信息:
IDI_ICON1 ICON "main.ico" #if defined(UNDER_CE) #include <winbase.h> #else #include <winver.h> #endif VS_VERSION_INFO VERSIONINFO FILEVERSION 1,0,0,0 PRODUCTVERSION 1,0,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS VS_FF_DEBUG #else FILEFLAGS 0x0L #endif FILEOS VOS__WINDOWS32 FILETYPE VFT_DLL FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "080404b0" BEGIN VALUE "CompanyName", "BeiJing XXXX Co., Ltd." VALUE "FileDescription", "Industrial Control System" VALUE "FileVersion", "1.0.0.0" VALUE "InternalName", "Qt Studio.exe" VALUE "LegalCopyright", "Copyright (C)2009-2020" VALUE "OriginalFilename", "Qt Studio.exe" VALUE "ProductName", "Qt Studio" VALUE "ProductVersion", "1.0.0.0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x804, 1200 END END
然后将pro文件的RC_FILE = ???.rc,如此一来编译生成的程序就会含有图标和版本信息。