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 DECLARATIVESPLINESERIES_H
14#define DECLARATIVESPLINESERIES_H
15
16#include <QtQml/qqmlregistration.h>
17#include <QtCharts/QSplineSeries>
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
25QT_BEGIN_NAMESPACE
26
27class Q_CHARTSQML_PRIVATE_EXPORT DeclarativeSplineSeries : public QSplineSeries, 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 width READ width WRITE setWidth NOTIFY widthChanged REVISION(1, 1))
39 Q_PROPERTY(Qt::PenStyle style READ style WRITE setStyle NOTIFY styleChanged REVISION(1, 1))
40 Q_PROPERTY(Qt::PenCapStyle capStyle READ capStyle WRITE setCapStyle NOTIFY capStyleChanged REVISION(1, 1))
41 Q_PROPERTY(QQmlListProperty<QObject> declarativeChildren READ declarativeChildren)
42 Q_CLASSINFO("DefaultProperty", "declarativeChildren")
43 QML_NAMED_ELEMENT(SplineSeries)
44 QML_ADDED_IN_VERSION(1, 0)
45 QML_EXTRA_VERSION(2, 0)
46
47public:
48 explicit DeclarativeSplineSeries(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 width() const;
63 void setWidth(qreal width);
64 Qt::PenStyle style() const;
65 void setStyle(Qt::PenStyle style);
66 Qt::PenCapStyle capStyle() const;
67 void setCapStyle(Qt::PenCapStyle capStyle);
68 QQmlListProperty<QObject> declarativeChildren();
69
70public: // from QDeclarativeParserStatus
71 void classBegin() override { DeclarativeXySeries::classBegin(); }
72 void componentComplete() override { DeclarativeXySeries::componentComplete(); }
73
74public:
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
85Q_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, 2) void axisXTopChanged(QAbstractAxis *axis);
90 Q_REVISION(1, 2) void axisYRightChanged(QAbstractAxis *axis);
91 Q_REVISION(1, 3) void axisAngularChanged(QAbstractAxis *axis);
92 Q_REVISION(1, 3) void axisRadialChanged(QAbstractAxis *axis);
93 Q_REVISION(1, 1) void widthChanged(qreal width);
94 Q_REVISION(1, 1) void styleChanged(Qt::PenStyle style);
95 Q_REVISION(1, 1) void capStyleChanged(Qt::PenCapStyle capStyle);
96
97public Q_SLOTS:
98 static void appendDeclarativeChildren(QQmlListProperty<QObject> *list, QObject *element);
99 void handleCountChanged(int index);
100
101public:
102 DeclarativeAxes *m_axes;
103};
104
105QT_END_NAMESPACE
106
107#endif // DECLARATIVESPLINESERIES_H
108

source code of qtcharts/src/chartsqml2/declarativesplineseries_p.h