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 {Spinning busy indicator showing activity in progress}
21
22 The busy indicator should be used to indicate activity while content is
23 being loaded or the UI is blocked waiting for a resource to become available.
24
25 The following snippet shows how to use the BusyIndicator:
26
27 \qml
28 BusyIndicator {
29 running: image.status === Image.Loading
30 }
31 \endqml
32
33 BusyIndicator is similar to an indeterminate \l ProgressBar. Both can be
34 used to indicate background activity. The main difference is visual, and
35 that ProgressBar can also present a concrete amount of progress (when it
36 can be determined). Due to the visual difference, busy indicators and
37 indeterminate progress bars fit different places in user interfaces.
38 Typical places for a busy indicator:
39 \list
40 \li in the corner of a \l ToolBar
41 \li as an overlay on top of a \l Page
42 \li on the side of an \l ItemDelegate
43 \endlist
44
45 \sa {Customizing BusyIndicator}, {Indicator Controls}, ProgressBar
46*/
47
49{
50public:
51 bool running = true;
52};
53
54QQuickBusyIndicator::QQuickBusyIndicator(QQuickItem *parent)
55 : QQuickControl(*(new QQuickBusyIndicatorPrivate), parent)
56{
57}
58
59/*!
60 \qmlproperty bool QtQuick.Controls::BusyIndicator::running
61
62 This property holds whether the busy indicator is currently indicating
63 activity.
64
65 \note The indicator is only visible when this property is set to \c true.
66
67 The default value is \c true.
68*/
69bool QQuickBusyIndicator::isRunning() const
70{
71 Q_D(const QQuickBusyIndicator);
72 return d->running;
73}
74
75void QQuickBusyIndicator::setRunning(bool running)
76{
77 Q_D(QQuickBusyIndicator);
78 if (d->running == running)
79 return;
80
81 d->running = running;
82 emit runningChanged();
83}
84
85#if QT_CONFIG(quicktemplates2_multitouch)
86void QQuickBusyIndicator::touchEvent(QTouchEvent *event)
87{
88 event->ignore(); // QTBUG-61785
89}
90#endif
91
92#if QT_CONFIG(accessibility)
93QAccessible::Role QQuickBusyIndicator::accessibleRole() const
94{
95 return QAccessible::Indicator;
96}
97#endif
98
99QT_END_NAMESPACE
100
101#include "moc_qquickbusyindicator_p.cpp"
Indicates background activity, for example, while content is being loaded.
Combined button and popup list for selecting options.