O'Reilly logo

Qt 5 Blueprints by Symeon Huang

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding BusyIndicator

The absence of a busy indicator makes people uncomfortable as well. No matter how short or long indicator it is, it takes time to download data and parse XML. I'm pretty sure you'd like to add such an indicator, which tells users to calm down and wait. Luckily, BusyIndicator, which is simply a running circle, is an element of QtQuick.Controls. This does exactly what we want.

What you need to do is to add these lines to main.qml inside the Window item:

BusyIndicator {
  anchors.centerIn: newsView
  running: newsModel.status == XmlListModel.Loading
}

Note that we don't need to change the visible property of BusyIndicator, because BusyIndicator is only visible when the running property is set to true. In this case, we set running to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required