Skip to content

Instantly share code, notes, and snippets.

@kimmoli
Created December 19, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimmoli/edf1feaba57497aa0fa6 to your computer and use it in GitHub Desktop.
Save kimmoli/edf1feaba57497aa0fa6 to your computer and use it in GitHub Desktop.
noarch version from spec to QML
...
system(echo "\\\{\\\"version\\\":\\\"$${SPECVERSION}\\\"\\\}" > qml/version.json)
...
ApplicationWindow
{
..blaa..
property var application
Component.onCompleted:
{
var xhr = new XMLHttpRequest
xhr.onreadystatechange = (function(myxhr)
{
return function()
{
if (myxhr.readyState === 4)
{
application = JSON.parse(myxhr.responseText)
}
}
})(xhr);
xhr.open("GET", Qt.resolvedUrl("version.json"), true)
xhr.send();
}
...blaa...
}
use e.g.
text: "version: " + application.version
...
%qtc_qmake5 SPECVERSION=%{version}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment