Ask / Submit

How to manage app's own version and display name?

asked 2016-06-14 10:32:37 +0200

Fiery gravatar image

I'm about to finish my first Sailfish OS app, and bumped into an issue that works quite smoothly on other platforms (green robot, Tizen, etc) I need to show my app's own display name and version number on the About page, and also use them in case the user wants to send an email via my app. I've tried to use QGuiApplication.applicationName, applicationDisplayName and applicationVersion, but they don't contain the expected information. applicationName and applicationDisplayName both contains the same string "harbour-MY_APP_NAME", instead of the display name I've specified in the .desktop file. And applicationVersion is empty.

As far as I can tell, I can specify the display name in the .desktop file, but how can I parse the .desktop file from my app? And I can put the version number in the .spec file, but how to parse it from the app?

edit retag flag offensive close delete

1 Answer

Sort by » oldest newest most voted

answered 2016-06-14 11:17:31 +0200

tortoisedoc gravatar image

See MLite package which has MDesktopEntry class, which contains interfaces to interact with .desktop files. But true, you would expect the app to return info from the .desktop file directly. Perhaps it could be added as a configuration option (somewhere in the Qt Layer?)

edit flag offensive delete publish link more


Thank you! Parsing .desktop file sadly doesn't give me the version number of the app :-( Is there a trick up your sleeve for that too? ;-)

Fiery ( 2016-06-14 12:40:12 +0200 )edit

@Fiery, you could add


in your .pro, register it in root context as a property [ setContextProperty("APP_VERSION", APP_VERSION) ] and use it QML .

Edit: Also give VERSION as a qmake option in yaml file.

You could see the working example at

rinigus ( 2016-06-14 12:58:21 +0200 )edit

That works great, thanks a lot! :-)

Fiery ( 2016-06-14 14:55:56 +0200 )edit

Forget about YAML, focus on specs. AFAIK yaml is on the way out?

tortoisedoc ( 2016-06-14 19:24:25 +0200 )edit
Login/Signup to Answer

Question tools



Asked: 2016-06-14 10:32:37 +0200

Seen: 161 times

Last updated: Jun 14 '16