From 9e2accf33e92b9363ba656fddac7e0ca47402f99 Mon Sep 17 00:00:00 2001 From: "Denis V. Dedkov" Date: Thu, 9 Aug 2018 22:49:48 +0200 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20Bu?= =?UTF-8?q?ssyIndicator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HomeForm.qml | 5 +++++ LightsModel.qml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/HomeForm.qml b/HomeForm.qml index f43d794..67502a6 100644 --- a/HomeForm.qml +++ b/HomeForm.qml @@ -27,4 +27,9 @@ Page { lights: channels } } + + BusyIndicator { + anchors.centerIn: parent + running: lightsModel.isLoading + } } diff --git a/LightsModel.qml b/LightsModel.qml index fe2bb45..e2d4140 100644 --- a/LightsModel.qml +++ b/LightsModel.qml @@ -4,6 +4,7 @@ ListModel { id: root property string serviceUrl: undefined + property bool isLoading: false signal error(string text) @@ -20,14 +21,18 @@ ListModel { if (request.status === 200) { populateModel(JSON.parse(request.responseText)) + root.isLoading = false return } root.error(qsTr("[%1] Request error: %2"). arg(request.status). arg(request.statusText)) + + root.isLoading = false } + root.isLoading = true request.send() }