Skip to content

Instantly share code, notes, and snippets.

@kimmoli kimmoli/project.pro

Created Dec 19, 2015
Embed
What would you like to do?
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
You can’t perform that action at this time.