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 ?


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

  • OK, well that explains why they always are empty.

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

  • 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.
    // .pro

    // .cpp

  • I'll try that.


  • @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

  • 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?

  • 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

  • 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.

  • 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.

Log in to reply