Taskwarrior.qml: workaround handling of files in qml.
This commit is contained in:
parent
325d4638cc
commit
ab969a10c8
2 changed files with 11 additions and 6 deletions
|
@ -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();
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue