[SailfishDevel] Retrieve application version

jerome levreau levreau.jerome at vostoksystem.eu
Sun Sep 3 08:44:23 UTC 2017


hi,
to get version of MY app while running I'm creating a variable :

in .spec, add / change :
%qtc_qmake5  \
    VERSION=%{version}

in .pro add :
DEFINES += APP_VERSION=\"\\\"$${VERSION}\\\"\"

then in cpp, set version to the QGuiApplication :
app->setApplicationVersion(QString(APP_VERSION));

from qml :
Qt.application.version

from cpp :
QCoreApplication::applicationVersion();

Note, when you change version number, you need to to a full clean/rebuild


2017-09-03 8:59 GMT+02:00 Dylan Van Assche via Devel <
devel at lists.sailfishos.org>:

> Hi,
>
> I'm trying to update the application version everytime I change it in the
> .SPEC file but it seems that there's no Harbour allowed API is available to
> querry the application version when running?
> My last help would be parsing a "pkcon search name <app>" but if there's a
> better method available, that would be great.
>
> Kind regards,
> Dylan Van Assche
>
>
>
>
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscribe at lists.
> sailfishos.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20170903/8d36a38a/attachment.html>


More information about the Devel mailing list