Taskwarrior.qml: workaround handling of files in qml.

This commit is contained in:
Oscar Andreasson 2015-11-30 09:32:54 +01:00
parent 325d4638cc
commit ab969a10c8
2 changed files with 11 additions and 6 deletions

View file

@ -15,7 +15,11 @@ Item {
property ListModel model : ListModel { id: jsonModel }
property alias count: jsonModel.count
onSourceChanged: {
onSourceChanged: fetchJSONModel()
onJsonChanged: updateJSONModel()
onQueryChanged: updateJSONModel()
function fetchJSONModel() {
var xhr = new XMLHttpRequest;
xhr.open("GET", source);
xhr.onreadystatechange = function() {
@ -25,9 +29,6 @@ Item {
xhr.send();
}
onJsonChanged: updateJSONModel()
onQueryChanged: updateJSONModel()
function updateJSONModel() {
jsonModel.clear();

View file

@ -14,16 +14,20 @@ Rectangle {
id: root
color: "black"
property string fileName: "jsondata.txt"
property string fileName: "/home/oan/Projects/private/QmlMirror/QmlMirror/jsondata.txt"
JSONListModel {
id: jsonModel
source: fileName
source: root.fileName
}
TaskWarrior {
id: taskwarrior
jsonFile: fileName
onJsonFileChanged: {
jsonModel.fetchJSONModel()
}
}
Timer {