Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickbusyindicator.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
7
9
10/*!
11 \qmltype BusyIndicator
12 \inherits Control
13//! \nativetype QQuickBusyIndicator
14 \inqmlmodule QtQuick.Controls
15 \since 5.7
16 \ingroup qtquickcontrols-indicators
17 \brief Indicates background activity, for example, while content is being loaded.
18
19 \image qtquickcontrols-busyindicator.gif
20
21 The busy indicator should be used to indicate activity while content is
22 being loaded or the UI is blocked waiting for a resource to become available.
23
24 The following snippet shows how to use the BusyIndicator:
25
26 \qml
27 BusyIndicator {
28 running: image.status === Image.Loading
29 }
30 \endqml
31
32 BusyIndicator is similar to an indeterminate \l ProgressBar. Both can be
33 used to indicate background activity. The main difference is visual, and
34 that ProgressBar can also present a concrete amount of progress (when it
35 can be determined). Due to the visual difference, busy indicators and
36 indeterminate progress bars fit different places in user interfaces.
37 Typical places for a busy indicator:
38 \list
39 \li in the corner of a \l ToolBar
40 \li as an overlay on top of a \l Page
41 \li on the side of an \l ItemDelegate
42 \endlist
43
44 \sa {Customizing BusyIndicator}, {Indicator Controls}, ProgressBar
45*/
46
48{
49public:
50 bool running = true;
51};
52
53QQuickBusyIndicator::QQuickBusyIndicator(QQuickItem *parent)
54 : QQuickControl(*(new QQuickBusyIndicatorPrivate), parent)
55{
56}
57
58/*!
59 \qmlproperty bool QtQuick.Controls::BusyIndicator::running
60
61 This property holds whether the busy indicator is currently indicating
62 activity.
63
64 \note The indicator is only visible when this property is set to \c true.
65
66 The default value is \c true.
67*/
68bool QQuickBusyIndicator::isRunning() const
69{
70 Q_D(const QQuickBusyIndicator);
71 return d->running;
72}
73
74void QQuickBusyIndicator::setRunning(bool running)
75{
76 Q_D(QQuickBusyIndicator);
77 if (d->running == running)
78 return;
79
80 d->running = running;
81 emit runningChanged();
82}
83
84#if QT_CONFIG(quicktemplates2_multitouch)
85void QQuickBusyIndicator::touchEvent(QTouchEvent *event)
86{
87 event->ignore(); // QTBUG-61785
88}
89#endif
90
91#if QT_CONFIG(accessibility)
92QAccessible::Role QQuickBusyIndicator::accessibleRole() const
93{
94 return QAccessible::Indicator;
95}
96#endif
97
98QT_END_NAMESPACE
99
100#include "moc_qquickbusyindicator_p.cpp"
Indicates background activity, for example, while content is being loaded.