| 1 | // Copyright (C) 2021 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 | |
| 4 | #ifndef QQUICKDEFAULTBUSYINDICATOR_P_H | 
| 5 | #define QQUICKDEFAULTBUSYINDICATOR_P_H | 
| 6 | |
| 7 | // | 
| 8 | // W A R N I N G | 
| 9 | // ------------- | 
| 10 | // | 
| 11 | // This file is not part of the Qt API. It exists purely as an | 
| 12 | // implementation detail. This header file may change from version to | 
| 13 | // version without notice, or even be removed. | 
| 14 | // | 
| 15 | // We mean it. | 
| 16 | // | 
| 17 | |
| 18 | #include <QtQuick/qquickitem.h> | 
| 19 | #include <QtGui/qcolor.h> | 
| 20 | #include <QtCore/private/qglobal_p.h> | 
| 21 | |
| 22 | QT_BEGIN_NAMESPACE | 
| 23 | |
| 24 | class QQuickBasicBusyIndicator : public QQuickItem | 
| 25 | { | 
| 26 | Q_OBJECT | 
| 27 | Q_PROPERTY(QColor pen READ pen WRITE setPen FINAL) | 
| 28 | Q_PROPERTY(QColor fill READ fill WRITE setFill FINAL) | 
| 29 | Q_PROPERTY(bool running READ isRunning WRITE setRunning) | 
| 30 | QML_NAMED_ELEMENT(BusyIndicatorImpl) | 
| 31 | QML_ADDED_IN_VERSION(2, 0) | 
| 32 | |
| 33 | public: | 
| 34 | explicit QQuickBasicBusyIndicator(QQuickItem *parent = nullptr); | 
| 35 | |
| 36 | QColor pen() const; | 
| 37 | void setPen(const QColor &pen); | 
| 38 | |
| 39 | QColor fill() const; | 
| 40 | void setFill(const QColor &fill); | 
| 41 | |
| 42 | bool isRunning() const; | 
| 43 | void setRunning(bool running); | 
| 44 | |
| 45 | int elapsed() const; | 
| 46 | |
| 47 | protected: | 
| 48 | void itemChange(ItemChange change, const ItemChangeData &data) override; | 
| 49 | QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override; | 
| 50 | |
| 51 | private: | 
| 52 | bool m_running = false; | 
| 53 | int m_elapsed = 0; | 
| 54 | QColor m_pen; | 
| 55 | QColor m_fill; | 
| 56 | }; | 
| 57 | |
| 58 | QT_END_NAMESPACE | 
| 59 | |
| 60 | #endif // QQUICKDEFAULTBUSYINDICATOR_P_H | 
| 61 | 
