1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2016 The Qt Company Ltd. 4 ** Contact: https://www.qt.io/licensing/ 5 ** 6 ** This file is part of the Qt Charts module of the Qt Toolkit. 7 ** 8 ** $QT_BEGIN_LICENSE:GPL$ 9 ** Commercial License Usage 10 ** Licensees holding valid commercial Qt licenses may use this file in 11 ** accordance with the commercial license agreement provided with the 12 ** Software or, alternatively, in accordance with the terms contained in 13 ** a written agreement between you and The Qt Company. For licensing terms 14 ** and conditions see https://www.qt.io/terms-conditions. For further 15 ** information use the contact form at https://www.qt.io/contact-us. 16 ** 17 ** GNU General Public License Usage 18 ** Alternatively, this file may be used under the terms of the GNU 19 ** General Public License version 3 or (at your option) any later version 20 ** approved by the KDE Free Qt Foundation. The licenses are as published by 21 ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22 ** included in the packaging of this file. Please review the following 23 ** information to ensure the GNU General Public License requirements will 24 ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 ** 26 ** $QT_END_LICENSE$ 27 ** 28 ****************************************************************************/ 29 30 // W A R N I N G 31 // ------------- 32 // 33 // This file is not part of the Qt Chart API. It exists purely as an 34 // implementation detail. This header file may change from version to 35 // version without notice, or even be removed. 36 // 37 // We mean it. 38 39 #ifndef DECLARATIVESCATTERSERIES_H 40 #define DECLARATIVESCATTERSERIES_H 41 42 #include <QtCharts/QScatterSeries> 43 #include <private/declarativechartglobal_p.h> 44 #include <private/declarativexyseries_p.h> 45 #include <private/declarativeaxes_p.h> 46 47 #include <QtQml/QQmlListProperty> 48 #include <QtQml/QQmlParserStatus> 49 50 QT_CHARTS_BEGIN_NAMESPACE 51 52 class Q_QMLCHARTS_PRIVATE_EXPORT DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeries, public QQmlParserStatus 53 { 54 Q_OBJECT 55 Q_INTERFACES(QQmlParserStatus) 56 Q_PROPERTY(int count READ count NOTIFY countChanged) 57 Q_PROPERTY(QtCharts::QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) 58 Q_PROPERTY(QtCharts::QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) 59 Q_PROPERTY(QtCharts::QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2) 60 Q_PROPERTY(QtCharts::QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2) 61 Q_PROPERTY(QtCharts::QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3) 62 Q_PROPERTY(QtCharts::QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3) 63 Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1) 64 Q_PROPERTY(QQmlListProperty<QObject> declarativeChildren READ declarativeChildren) 65 Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 4) 66 Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged REVISION 4) 67 Q_CLASSINFO("DefaultProperty", "declarativeChildren") 68 69 public: 70 explicit DeclarativeScatterSeries(QObject *parent = 0); xySeries()71 QXYSeries *xySeries() { return this; } axisX()72 QAbstractAxis *axisX() { return m_axes->axisX(); } setAxisX(QAbstractAxis * axis)73 void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } axisY()74 QAbstractAxis *axisY() { return m_axes->axisY(); } setAxisY(QAbstractAxis * axis)75 void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } axisXTop()76 QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } setAxisXTop(QAbstractAxis * axis)77 void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } axisYRight()78 QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } setAxisYRight(QAbstractAxis * axis)79 void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } axisAngular()80 QAbstractAxis *axisAngular() { return m_axes->axisX(); } setAxisAngular(QAbstractAxis * axis)81 void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); } axisRadial()82 QAbstractAxis *axisRadial() { return m_axes->axisY(); } setAxisRadial(QAbstractAxis * axis)83 void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); } 84 qreal borderWidth() const; 85 void setBorderWidth(qreal borderWidth); 86 QQmlListProperty<QObject> declarativeChildren(); 87 QString brushFilename() const; 88 void setBrushFilename(const QString &brushFilename); 89 void setBrush(const QBrush &brush); 90 QBrush brush() const; 91 92 public: // from QDeclarativeParserStatus classBegin()93 void classBegin() { DeclarativeXySeries::classBegin(); } componentComplete()94 void componentComplete() { DeclarativeXySeries::componentComplete(); } 95 96 public: append(qreal x,qreal y)97 Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); } replace(qreal oldX,qreal oldY,qreal newX,qreal newY)98 Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); } replace(int index,qreal newX,qreal newY)99 Q_REVISION(3) Q_INVOKABLE void replace(int index, qreal newX, qreal newY) { DeclarativeXySeries::replace(index, newX, newY); } remove(qreal x,qreal y)100 Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); } remove(int index)101 Q_REVISION(3) Q_INVOKABLE void remove(int index) { DeclarativeXySeries::remove(index); } removePoints(int index,int count)102 Q_REVISION(5) Q_INVOKABLE void removePoints(int index, int count) { DeclarativeXySeries::removePoints(index, count); } insert(int index,qreal x,qreal y)103 Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); } clear()104 Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); } at(int index)105 Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); } 106 107 Q_SIGNALS: 108 void countChanged(int count); 109 Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); 110 Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); 111 Q_REVISION(1) void borderWidthChanged(qreal width); 112 Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis); 113 Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis); 114 Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis); 115 Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis); 116 Q_REVISION(4) void brushFilenameChanged(const QString &brushFilename); 117 Q_REVISION(4) void brushChanged(); 118 119 public Q_SLOTS: 120 static void appendDeclarativeChildren(QQmlListProperty<QObject> *list, QObject *element); 121 void handleCountChanged(int index); 122 123 private Q_SLOTS: 124 void handleBrushChanged(); 125 126 public: 127 DeclarativeAxes *m_axes; 128 129 private: 130 QString m_brushFilename; 131 QImage m_brushImage; 132 }; 133 134 QT_CHARTS_END_NAMESPACE 135 136 #endif // DECLARATIVESCATTERSERIES_H 137