1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | // W A R N I N G |
5 | // ------------- |
6 | // |
7 | // This file is not part of the Qt Chart API. It exists purely as an |
8 | // implementation detail. This header file may change from version to |
9 | // version without notice, or even be removed. |
10 | // |
11 | // We mean it. |
12 | |
13 | #ifndef DECLARATIVESCATTERSERIES_H |
14 | #define DECLARATIVESCATTERSERIES_H |
15 | |
16 | #include <QtQml/qqmlregistration.h> |
17 | #include <QtCharts/QScatterSeries> |
18 | #include <private/declarativechartglobal_p.h> |
19 | #include <private/declarativexyseries_p.h> |
20 | #include <private/declarativeaxes_p.h> |
21 | |
22 | #include <QtQml/QQmlListProperty> |
23 | #include <QtQml/QQmlParserStatus> |
24 | |
25 | QT_BEGIN_NAMESPACE |
26 | |
27 | class Q_CHARTSQML_PRIVATE_EXPORT DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeries, public QQmlParserStatus |
28 | { |
29 | Q_OBJECT |
30 | Q_INTERFACES(QQmlParserStatus) |
31 | Q_PROPERTY(int count READ count NOTIFY countChanged) |
32 | Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION(1, 1)) |
33 | Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION(1, 1)) |
34 | Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION(1, 2)) |
35 | Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION(1, 2)) |
36 | Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION(1, 3)) |
37 | Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION(1, 3)) |
38 | Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION(1, 1)) |
39 | Q_PROPERTY(QQmlListProperty<QObject> declarativeChildren READ declarativeChildren) |
40 | Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION(1, 4)) |
41 | Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged REVISION(1, 4)) |
42 | Q_CLASSINFO("DefaultProperty" , "declarativeChildren" ) |
43 | QML_NAMED_ELEMENT(ScatterSeries) |
44 | QML_ADDED_IN_VERSION(1, 0) |
45 | QML_EXTRA_VERSION(2, 0) |
46 | |
47 | public: |
48 | explicit DeclarativeScatterSeries(QObject *parent = 0); |
49 | QXYSeries *xySeries() override { return this; } |
50 | QAbstractAxis *axisX() { return m_axes->axisX(); } |
51 | void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } |
52 | QAbstractAxis *axisY() { return m_axes->axisY(); } |
53 | void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } |
54 | QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } |
55 | void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } |
56 | QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } |
57 | void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } |
58 | QAbstractAxis *axisAngular() { return m_axes->axisX(); } |
59 | void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); } |
60 | QAbstractAxis *axisRadial() { return m_axes->axisY(); } |
61 | void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); } |
62 | qreal borderWidth() const; |
63 | void setBorderWidth(qreal borderWidth); |
64 | QQmlListProperty<QObject> declarativeChildren(); |
65 | QString brushFilename() const; |
66 | void setBrushFilename(const QString &brushFilename); |
67 | void setBrush(const QBrush &brush) override; |
68 | QBrush brush() const; |
69 | |
70 | public: // from QDeclarativeParserStatus |
71 | void classBegin() override { DeclarativeXySeries::classBegin(); } |
72 | void componentComplete() override { DeclarativeXySeries::componentComplete(); } |
73 | |
74 | public: |
75 | Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); } |
76 | Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); } |
77 | Q_REVISION(1, 3) Q_INVOKABLE void replace(int index, qreal newX, qreal newY) { DeclarativeXySeries::replace(index, newX, newY); } |
78 | Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); } |
79 | Q_REVISION(1, 3) Q_INVOKABLE void remove(int index) { DeclarativeXySeries::remove(index); } |
80 | Q_REVISION(2, 1) Q_INVOKABLE void removePoints(int index, int count) { DeclarativeXySeries::removePoints(index, count); } |
81 | Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); } |
82 | Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); } |
83 | Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); } |
84 | |
85 | Q_SIGNALS: |
86 | void countChanged(int count); |
87 | Q_REVISION(1, 1) void axisXChanged(QAbstractAxis *axis); |
88 | Q_REVISION(1, 1) void axisYChanged(QAbstractAxis *axis); |
89 | Q_REVISION(1, 1) void borderWidthChanged(qreal width); |
90 | Q_REVISION(1, 2) void axisXTopChanged(QAbstractAxis *axis); |
91 | Q_REVISION(1, 2) void axisYRightChanged(QAbstractAxis *axis); |
92 | Q_REVISION(1, 3) void axisAngularChanged(QAbstractAxis *axis); |
93 | Q_REVISION(1, 3) void axisRadialChanged(QAbstractAxis *axis); |
94 | Q_REVISION(1, 4) void brushFilenameChanged(const QString &brushFilename); |
95 | Q_REVISION(1, 4) void brushChanged(); |
96 | |
97 | public Q_SLOTS: |
98 | static void appendDeclarativeChildren(QQmlListProperty<QObject> *list, QObject *element); |
99 | void handleCountChanged(int index); |
100 | |
101 | private Q_SLOTS: |
102 | void handleBrushChanged(); |
103 | |
104 | public: |
105 | DeclarativeAxes *m_axes; |
106 | |
107 | private: |
108 | QString m_brushFilename; |
109 | QImage m_brushImage; |
110 | }; |
111 | |
112 | QT_END_NAMESPACE |
113 | |
114 | #endif // DECLARATIVESCATTERSERIES_H |
115 | |