Добавил BussyIndicator

This commit is contained in:
2018-08-09 22:49:48 +02:00
parent 1e3629cea9
commit 9e2accf33e
2 changed files with 10 additions and 0 deletions

View File

@@ -27,4 +27,9 @@ Page {
lights: channels lights: channels
} }
} }
BusyIndicator {
anchors.centerIn: parent
running: lightsModel.isLoading
}
} }

View File

@@ -4,6 +4,7 @@ ListModel {
id: root id: root
property string serviceUrl: undefined property string serviceUrl: undefined
property bool isLoading: false
signal error(string text) signal error(string text)
@@ -20,14 +21,18 @@ ListModel {
if (request.status === 200) { if (request.status === 200) {
populateModel(JSON.parse(request.responseText)) populateModel(JSON.parse(request.responseText))
root.isLoading = false
return return
} }
root.error(qsTr("[%1] Request error: %2"). root.error(qsTr("[%1] Request error: %2").
arg(request.status). arg(request.status).
arg(request.statusText)) arg(request.statusText))
root.isLoading = false
} }
root.isLoading = true
request.send() request.send()
} }