Book Image

QT5 Blueprints

By : Symeon Huang
Book Image

QT5 Blueprints

By: Symeon Huang

Overview of this book

Table of Contents (17 chapters)
Qt 5 Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 true when the newsModel status is Loading.