Windows下的.exe可执行文件的属性中有版本这个信息,含有版本信息、描述、版权等。对于qt程序,要含有这样的信息,那就请如下操作:新建<工程名>.rc文件,在rc文件填入下的信息:
#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)2001-2013"
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,如此一来编译生成的程序就会含有版本信息。
http://blog.csdn.net/libaineu2004/article/details/17362777
---------------------------------------------------------------------------------------------------
1、添加resource.rc文件到项目
IDI_ICON1 ICON DISCARDABLE "app.ico"
#include
#include "version.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_PRODUCTVERSION
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", VER_COMPANYNAME_STR
VALUE "FileDescription", VER_FILEDESCRIPTION_STR
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", VER_INTERNALNAME_STR
VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
VALUE "LegalTrademarks1", VER_LEGALTRADEMARKS1_STR
VALUE "LegalTrademarks2", VER_LEGALTRADEMARKS2_STR
VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
VALUE "ProductName", VER_PRODUCTNAME_STR
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END
同时需要添加一个名为version.h的头文件:
#ifndef VERSION_H
#define VERSION_H
#define VER_FILEVERSION 1,0,0,0 //文件版本
#define VER_FILEVERSION_STR "1.0.0.0 "
#define VER_PRODUCTVERSION 1,0,0,0
#define VER_PRODUCTVERSION_STR "1.0 " //产品版本
#define VER_COMPANYNAME_STR "Digia"
#define VER_FILEDESCRIPTION_STR "Qt" //文件说明
#define VER_INTERNALNAME_STR "Qt"
#define VER_LEGALCOPYRIGHT_STR "Copyright 2008-2015 Digia Plc" //版权
#define VER_LEGALTRADEMARKS1_STR "All rights reserved"
#define VER_LEGALTRADEMARKS2_STR VER_LEGALTRADEMARKS1_STR
#define VER_ORIGINALFILENAME_STR "Qt.exe" //原始文件名
#define VER_PRODUCTNAME_STR "Qt" //产品名称
#define VER_COMPANYDOMAIN_STR "example.org"
#endif //VERSION_H
2.配置到项目
在pro中添加
RC_FILE= resource.rc
这样,程序的信息就设置成功了。。。
http://blog.sina.com.cn/s/blog_a6fb6cc90102vqf0.html