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 QQUICKDEFAULTPROGRESSBAR_P_H |
5 | #define QQUICKDEFAULTPROGRESSBAR_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 QQuickBasicProgressBar : public QQuickItem |
25 | { |
26 | Q_OBJECT |
27 | Q_PROPERTY(bool indeterminate READ isIndeterminate WRITE setIndeterminate FINAL) |
28 | Q_PROPERTY(qreal progress READ progress WRITE setProgress FINAL) |
29 | Q_PROPERTY(QColor color READ color WRITE setColor FINAL) |
30 | QML_NAMED_ELEMENT(ProgressBarImpl) |
31 | QML_ADDED_IN_VERSION(2, 0) |
32 | |
33 | public: |
34 | explicit QQuickBasicProgressBar(QQuickItem *parent = nullptr); |
35 | |
36 | bool isIndeterminate() const; |
37 | void setIndeterminate(bool indeterminate); |
38 | |
39 | qreal progress() const; |
40 | void setProgress(qreal progress); |
41 | |
42 | QColor color() const; |
43 | void setColor(const QColor &color); |
44 | |
45 | protected: |
46 | void itemChange(ItemChange change, const ItemChangeData &data) override; |
47 | QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override; |
48 | |
49 | private: |
50 | qreal m_progress = 0; |
51 | bool m_indeterminate = false; |
52 | QColor m_color; |
53 | }; |
54 | |
55 | QT_END_NAMESPACE |
56 | |
57 | QML_DECLARE_TYPE(QQuickBasicProgressBar) |
58 | |
59 | #endif // QQUICKDEFAULTPROGRESSBAR_P_H |
60 |