With all those options given I prefer below one given by Bob. I actually have 
made a AppInfo class for generic stuff like read licensefile/changelog/version 
in the aboupage  long ago. But I used a header file with stupid duplicate of 
VERSION (I hade to manually change both yaml+app). I will for sure change this 
to use below solution in all my apps from now on.

Actually I think below should be added in the sailfishsdk creation app template 
:)


On Sunday, July 20, 2014 14:22:01 Chris Walker wrote:
> On Sun, 20 Jul 2014 14:58:16 +0200
> 
> Bob Jelica <sailf...@jelica.se> wrote:
> > Hey,
> > 
> > If you have this in your .yaml:
> > 
> > Version: 1.0.0
> > 
> > QMakeOptions:
> > - VERSION='%{version}-%{release}'
> > 
> > Then you can do this in your .pro file:
> > DEFINES += APP_VERSION=\\\"$$VERSION\\\"
> > 
> > That gives you the option to do this in your main.cpp:
> > QScopedPointer<QQuickView> view(SailfishApp::createView());
> > view->rootContext()->setContextProperty("APP_VERSION", APP_VERSION);
> > 
> > 
> > And BOOM! now you can use APP_VERSION wherever in your QML
> > (AboutPage.qml for example)
> > 
> > :)
> 
> Ah. I used to do something similar in my N900 version of the app except
> that I used to specify the version in the .pro file. I've never tried
> to incorporate it into the Sailfish version. I'll give your version
> another go now.
> 
> Thanks for that and thanks too to Andrey Kozhevnikov for his ideas.
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

-- 
"Put mankind back on earth"

_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Reply via email to