View Full Version : How can I know the version of my application? [Qt3]
Opilki_Inside
7th March 2006, 09:50
Hello!
My pro-file consist a string:
VERSION=1.0
How can I get the version, wich I wrote in pro-file?
zlatko
7th March 2006, 09:54
maiby QSettings can help you, but i'm not sure
Opilki_Inside
7th March 2006, 09:57
QSettings does not consist information about version
zlatko
7th March 2006, 10:02
so use QFile and take it manually :eek:
Opilki_Inside
7th March 2006, 10:08
This method is not correct. Is there any functions to get the version number?
Mad Max
7th March 2006, 10:09
Hello!
My pro-file consist a string:
VERSION=1.0
How can I get the version, wich I wrote in pro-file?
It is from qmake manual:
VERSION - The version number of the target library, for example, 2.3.1.
Opilki_Inside
7th March 2006, 10:16
It is from qmake manual:
VERSION - The version number of the target library, for example, 2.3.1.
So what? I need to get this VERSION from source code of my application...
Mad Max
7th March 2006, 10:29
So what? I need to get this VERSION from source code of my application...
This template exist for UNIX libraries only (for formation of a name of the library file, such as libmy.so.1.1.0 ). If you wish to have the version of your app then keep it in a code as a constant.
wysota
7th March 2006, 11:18
So what? I need to get this VERSION from source code of my application...
So provide some method to get it :) For example look for 'static const char *version="1.0";' in your code. Use grep or whatever tool you like.
Smudge
7th March 2006, 16:53
My pro-file consist a string:
VERSION=1.0
How can I get the version, wich I wrote in pro-file?
If this is using windows, then qmake/make creates standard windows VS_VERSION_INFO resource information for your application. This can be accessed via the win32 function GetFileVersionInfo().
Obviously this is not platform independant. Unfortunately i don't know how this is handled on other platforms.
Smudge.
I somehow accidentally came across to a solution like this:
DEFINES += MYAPP_VERSION=0x000501"
QString version("%1.%2.%3").
.arg(MYAPP_VERSION & 0xFF0000)
.arg(MYAPP_VERSION & 0x00FF00)
.arg(MYAPP_VERSION & 0x0000FF); // "0.5.1"
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.