September 8, 2011

kimf kimf
Lab Rat
26 posts

How to retrieve program name & version

 

Hi

How do I retrieve program name and version of my application ?

I have tried using QCoreApplication.appVersion & QCoreApplication.appName, but they are always empty !

I have set Version = 1.5.0 in the .pro file, to no avail.

I using the latest Nokia SDK and developing for maemo.

Any ideas ?

Kim

9 replies

September 8, 2011

Lukas Geyer Lukas Geyer
Lab Rat
2074 posts

applicationName and applicationVersion aren’t automatically set, they have to be set by you.

September 8, 2011

kimf kimf
Lab Rat
26 posts

OK, well that explains why they always are empty.

But then, how do I retrieve the program version number ?

September 8, 2011

Lukas Geyer Lukas Geyer
Lab Rat
2074 posts

As far as I know the VERSION variable is used for generating appropriate filenames only. There is no automatic propagation to the applicationVersion property.

If you want to access variables set in your project file you will have to create preprocessor defines out of it.

  1. // .pro
  2. DEFINES += APP_NAME=\\\"$$TARGET\\\"
  3. DEFINES += APP_VERSION=\\\"$$VERSION\\\"
  4.  
  5. // .cpp
  6. application.setApplicationName(APP_NAME);
  7. application.setApplicationVersion(APP_VERSION);

September 8, 2011

kimf kimf
Lab Rat
26 posts

I’ll try that.

Thanks

September 11, 2011

Alicemirror Alicemirror
Lab Rat
825 posts

@Lukas, I have a similar problem at project level.

In Qt Creator withing projects for Harmattan Meego 1.2 the project release, version and subversion can be set in the project tab and are coherent with the package creation. Is there a similar way with project for Symbian and/or desktop devices?

Thanks you

 Signature 

Enrico Miglino (aka Alicemirror)
Tech Consulting
Islas Baleares, Ibiza (Spain)
http://www.contesti.eu

September 12, 2011

Lukas Geyer Lukas Geyer
Lab Rat
2074 posts

Not that I know of.

But the version information used in Harmattan projects is used for deployment only, and not automatically propagated to applicationVersion as well, is it?

September 12, 2011

Alicemirror Alicemirror
Lab Rat
825 posts

Lukas,

to be honest I think yes.
As what I have understood. It is very useful your note about symbian because I was just asking to myself how it was possible to have the same information for symbian applications. Now I am working on a Meego development so I will check in next hours if the application version really propagate to the in-program information.

The fact is that in Harmattan (that is a linux os) you are obliged to set the versioning in a correct way, not only. As I have experienced publishing with Ovi Store my Harmattan Application, the version number can only grow and never change with numbers less than the last you have created. Ovi store take this information from the application and the installer too: in the application info when it is installed on the device one of the information you see is just the release.version.subversion numbers.

Instead for symbian devices Ovi does not mention this aspect regarding the publishing of the applications. I was confused about the symbian case so now I check Harmattan and tell you asap. For symbian, I keep correct what you tell but I should read again the publishing specifications of Ovi Store. It is possible that before publishing Ovi requires a valid versioning system – with the method that you have mentioned – also for the symbian applications.
Without any settings, the symbian installed applications reports always the version 1.0.0

 Signature 

Enrico Miglino (aka Alicemirror)
Tech Consulting
Islas Baleares, Ibiza (Spain)
http://www.contesti.eu

September 12, 2011

Alicemirror Alicemirror
Lab Rat
825 posts

Hi,

I have checked now and confirm. The application informations seems to be propagated to the application. I suppose that it’s where the N950 installer manager read to give the information about the package, version etc.

 Signature 

Enrico Miglino (aka Alicemirror)
Tech Consulting
Islas Baleares, Ibiza (Spain)
http://www.contesti.eu

September 12, 2011

Tobias Hunger Tobias Hunger
Robot Herder
3386 posts

IIRC we use the version information for the packages only. They are put into the package’s meta-information, and not set on the QCoreApplication.

 
  ‹‹ wgt file not running on n950 developer edition.      Mouse don’t move ››

You must log in to post a reply. Not a member yet? Register here!