How do I set my application version for Windows in Qt?

时间:2017-04-06 17:08:12

标签: c++ qt qt4

When my application crashes, the Windows Event Viewer always reports my application version as "0.0.0.0". Windows Event Viewer version I can't figure how to set the application version in a way that the Windows Event Viewer recognizes. Changing it with QApplication::setApplicationVersion() doesn't seem to do it.

Obviously there are better ways to debug a program than the Windows Crash Log, but in lieu of all of that, how would I go about setting this value so that Windows recognizes it? My IDE is Qt Creator.

2 个答案:

答案 0 :(得分:5)

您可以在pro文件中设置VERSION qmake变量:

VERSION = 1.0.0.0

  

在Windows上,如果RC_FILE和,则触发自动生成.rc文件   未设置RES_FILE变量。生成的.rc文件将具有   FILEVERSION和PRODUCTVERSION条目填充主要,次要,补丁   等级和内部编号。

答案 1 :(得分:0)

使用QCoreApplication类。

QCoreApplication::setApplicationVersion("1.0");