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 QQUICKDEFAULTDIAL_P_H |
5 | #define QQUICKDEFAULTDIAL_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 <QtGui/qcolor.h> |
19 | #include <QtQuick/qquickpainteditem.h> |
20 | #include <QtCore/private/qglobal_p.h> |
21 | |
22 | QT_BEGIN_NAMESPACE |
23 | |
24 | class QQuickBasicDial : public QQuickPaintedItem |
25 | { |
26 | Q_OBJECT |
27 | Q_PROPERTY(qreal progress READ progress WRITE setProgress FINAL) |
28 | Q_PROPERTY(qreal startAngle READ startAngle WRITE setStartAngle FINAL) |
29 | Q_PROPERTY(qreal endAngle READ endAngle WRITE setEndAngle FINAL) |
30 | Q_PROPERTY(QColor color READ color WRITE setColor FINAL) |
31 | QML_NAMED_ELEMENT(DialImpl) |
32 | QML_ADDED_IN_VERSION(2, 0) |
33 | |
34 | public: |
35 | explicit QQuickBasicDial(QQuickItem *parent = nullptr); |
36 | |
37 | qreal progress() const; |
38 | void setProgress(qreal progress); |
39 | |
40 | qreal startAngle() const; |
41 | void setStartAngle(qreal startAngle); |
42 | |
43 | qreal endAngle() const; |
44 | void setEndAngle(qreal endAngle); |
45 | |
46 | QColor color() const; |
47 | void setColor(const QColor &color); |
48 | |
49 | void paint(QPainter *painter) override; |
50 | |
51 | private: |
52 | qreal m_progress = 0; |
53 | qreal m_startAngle = -140.; |
54 | qreal m_endAngle = 140.; |
55 | QColor m_color = Qt::black; |
56 | }; |
57 | |
58 | QT_END_NAMESPACE |
59 | |
60 | #endif // QQUICKDEFAULTDIAL_P_H |
61 | |