From 05f5f9a6f949522a92bd5bfe520358c2ba123d7b Mon Sep 17 00:00:00 2001 From: Peter Staab Date: Thu, 1 Feb 2018 14:12:38 +0100 Subject: Add private declarative headers Added private headers of the QtCharts Qml plugin. Task-number: QTBUG-66105 Change-Id: I9420c01b562b664e8849742abfbceed86861ce3e Reviewed-by: Miikka Heikkinen --- src/chartsqml2/chartsqml2.pro | 42 +-- src/chartsqml2/chartsqml2_plugin.cpp | 28 +- src/chartsqml2/declarativeabstractrendernode.h | 81 ----- src/chartsqml2/declarativeabstractrendernode_p.h | 91 ++++++ src/chartsqml2/declarativeareaseries.cpp | 6 +- src/chartsqml2/declarativeareaseries.h | 103 ------ src/chartsqml2/declarativeareaseries_p.h | 113 +++++++ src/chartsqml2/declarativeaxes.cpp | 4 +- src/chartsqml2/declarativeaxes.h | 81 ----- src/chartsqml2/declarativeaxes_p.h | 91 ++++++ src/chartsqml2/declarativebarseries.cpp | 4 +- src/chartsqml2/declarativebarseries.h | 370 ---------------------- src/chartsqml2/declarativebarseries_p.h | 380 +++++++++++++++++++++++ src/chartsqml2/declarativeboxplotseries.cpp | 6 +- src/chartsqml2/declarativeboxplotseries.h | 157 ---------- src/chartsqml2/declarativeboxplotseries_p.h | 167 ++++++++++ src/chartsqml2/declarativecandlestickseries.cpp | 6 +- src/chartsqml2/declarativecandlestickseries.h | 136 -------- src/chartsqml2/declarativecandlestickseries_p.h | 146 +++++++++ src/chartsqml2/declarativecategoryaxis.cpp | 4 +- src/chartsqml2/declarativecategoryaxis.h | 104 ------- src/chartsqml2/declarativecategoryaxis_p.h | 114 +++++++ src/chartsqml2/declarativechart.cpp | 30 +- src/chartsqml2/declarativechart.h | 264 ---------------- src/chartsqml2/declarativechart_p.h | 274 ++++++++++++++++ src/chartsqml2/declarativechartglobal_p.h | 54 ++++ src/chartsqml2/declarativechartnode.cpp | 6 +- src/chartsqml2/declarativechartnode.h | 61 ---- src/chartsqml2/declarativechartnode_p.h | 70 +++++ src/chartsqml2/declarativelineseries.cpp | 4 +- src/chartsqml2/declarativelineseries.h | 119 ------- src/chartsqml2/declarativelineseries_p.h | 129 ++++++++ src/chartsqml2/declarativemargins.cpp | 4 +- src/chartsqml2/declarativemargins.h | 63 ---- src/chartsqml2/declarativemargins_p.h | 73 +++++ src/chartsqml2/declarativeopenglrendernode.cpp | 2 +- src/chartsqml2/declarativeopenglrendernode.h | 110 ------- src/chartsqml2/declarativeopenglrendernode_p.h | 119 +++++++ src/chartsqml2/declarativepieseries.cpp | 4 +- src/chartsqml2/declarativepieseries.h | 94 ------ src/chartsqml2/declarativepieseries_p.h | 104 +++++++ src/chartsqml2/declarativepolarchart.cpp | 4 +- src/chartsqml2/declarativepolarchart.h | 50 --- src/chartsqml2/declarativepolarchart_p.h | 59 ++++ src/chartsqml2/declarativescatterseries.cpp | 4 +- src/chartsqml2/declarativescatterseries.h | 126 -------- src/chartsqml2/declarativescatterseries_p.h | 136 ++++++++ src/chartsqml2/declarativesplineseries.cpp | 4 +- src/chartsqml2/declarativesplineseries.h | 119 ------- src/chartsqml2/declarativesplineseries_p.h | 129 ++++++++ src/chartsqml2/declarativexypoint.cpp | 4 +- src/chartsqml2/declarativexypoint.h | 51 --- src/chartsqml2/declarativexypoint_p.h | 61 ++++ src/chartsqml2/declarativexyseries.cpp | 4 +- src/chartsqml2/declarativexyseries.h | 64 ---- src/chartsqml2/declarativexyseries_p.h | 74 +++++ sync.profile | 2 +- 57 files changed, 2472 insertions(+), 2237 deletions(-) delete mode 100644 src/chartsqml2/declarativeabstractrendernode.h create mode 100644 src/chartsqml2/declarativeabstractrendernode_p.h delete mode 100644 src/chartsqml2/declarativeareaseries.h create mode 100644 src/chartsqml2/declarativeareaseries_p.h delete mode 100644 src/chartsqml2/declarativeaxes.h create mode 100644 src/chartsqml2/declarativeaxes_p.h delete mode 100644 src/chartsqml2/declarativebarseries.h create mode 100644 src/chartsqml2/declarativebarseries_p.h delete mode 100644 src/chartsqml2/declarativeboxplotseries.h create mode 100644 src/chartsqml2/declarativeboxplotseries_p.h delete mode 100644 src/chartsqml2/declarativecandlestickseries.h create mode 100644 src/chartsqml2/declarativecandlestickseries_p.h delete mode 100644 src/chartsqml2/declarativecategoryaxis.h create mode 100644 src/chartsqml2/declarativecategoryaxis_p.h delete mode 100644 src/chartsqml2/declarativechart.h create mode 100644 src/chartsqml2/declarativechart_p.h create mode 100644 src/chartsqml2/declarativechartglobal_p.h delete mode 100644 src/chartsqml2/declarativechartnode.h create mode 100644 src/chartsqml2/declarativechartnode_p.h delete mode 100644 src/chartsqml2/declarativelineseries.h create mode 100644 src/chartsqml2/declarativelineseries_p.h delete mode 100644 src/chartsqml2/declarativemargins.h create mode 100644 src/chartsqml2/declarativemargins_p.h delete mode 100644 src/chartsqml2/declarativeopenglrendernode.h create mode 100644 src/chartsqml2/declarativeopenglrendernode_p.h delete mode 100644 src/chartsqml2/declarativepieseries.h create mode 100644 src/chartsqml2/declarativepieseries_p.h delete mode 100644 src/chartsqml2/declarativepolarchart.h create mode 100644 src/chartsqml2/declarativepolarchart_p.h delete mode 100644 src/chartsqml2/declarativescatterseries.h create mode 100644 src/chartsqml2/declarativescatterseries_p.h delete mode 100644 src/chartsqml2/declarativesplineseries.h create mode 100644 src/chartsqml2/declarativesplineseries_p.h delete mode 100644 src/chartsqml2/declarativexypoint.h create mode 100644 src/chartsqml2/declarativexypoint_p.h delete mode 100644 src/chartsqml2/declarativexyseries.h create mode 100644 src/chartsqml2/declarativexyseries_p.h diff --git a/src/chartsqml2/chartsqml2.pro b/src/chartsqml2/chartsqml2.pro index 57407e4d..57b3bd37 100644 --- a/src/chartsqml2/chartsqml2.pro +++ b/src/chartsqml2/chartsqml2.pro @@ -1,6 +1,7 @@ TARGET = qtchartsqml2 CXX_MODULE = charts +DEFINES += QT_BUILD_QMLCHARTS_LIB QT += qml quick QT += charts charts-private @@ -27,30 +28,33 @@ SOURCES += \ declarativechartnode.cpp \ declarativecandlestickseries.cpp -HEADERS += \ - declarativechart.h \ - declarativexypoint.h \ - declarativexyseries.h \ - declarativelineseries.h \ - declarativesplineseries.h \ - declarativeareaseries.h \ - declarativescatterseries.h \ - declarativepieseries.h \ - declarativebarseries.h \ - declarativecategoryaxis.h \ - declarativemargins.h \ - declarativeaxes.h \ - declarativepolarchart.h \ - declarativeboxplotseries.h \ - declarativechartnode.h \ - declarativecandlestickseries.h \ - declarativeabstractrendernode.h +PRIVATE_HEADERS += \ + declarativechart_p.h \ + declarativexypoint_p.h \ + declarativexyseries_p.h \ + declarativelineseries_p.h \ + declarativesplineseries_p.h \ + declarativeareaseries_p.h \ + declarativescatterseries_p.h \ + declarativepieseries_p.h \ + declarativebarseries_p.h \ + declarativecategoryaxis_p.h \ + declarativemargins_p.h \ + declarativeaxes_p.h \ + declarativepolarchart_p.h \ + declarativeboxplotseries_p.h \ + declarativecandlestickseries_p.h \ + declarativeabstractrendernode_p.h \ + declarativechartnode_p.h \ + declarativechartglobal_p.h contains(QT_CONFIG, opengl) { SOURCES += declarativeopenglrendernode.cpp - HEADERS += declarativeopenglrendernode.h + PRIVATE_HEADERS += declarativeopenglrendernode_p.h } +HEADERS += $$PRIVATE_HEADERS +INCLUDEPATH += $$PWD load(qml_plugin) diff --git a/src/chartsqml2/chartsqml2_plugin.cpp b/src/chartsqml2/chartsqml2_plugin.cpp index cc95948b..b1a9d412 100644 --- a/src/chartsqml2/chartsqml2_plugin.cpp +++ b/src/chartsqml2/chartsqml2_plugin.cpp @@ -31,27 +31,27 @@ #include #include #include -#include "declarativecategoryaxis.h" +#include "declarativecategoryaxis_p.h" #include -#include "declarativechart.h" -#include "declarativepolarchart.h" -#include "declarativexypoint.h" -#include "declarativelineseries.h" -#include "declarativesplineseries.h" -#include "declarativeareaseries.h" -#include "declarativescatterseries.h" -#include "declarativebarseries.h" -#include "declarativeboxplotseries.h" -#include "declarativecandlestickseries.h" -#include "declarativepieseries.h" -#include "declarativeaxes.h" +#include "declarativechart_p.h" +#include "declarativepolarchart_p.h" +#include "declarativexypoint_p.h" +#include "declarativelineseries_p.h" +#include "declarativesplineseries_p.h" +#include "declarativeareaseries_p.h" +#include "declarativescatterseries_p.h" +#include "declarativebarseries_p.h" +#include "declarativeboxplotseries_p.h" +#include "declarativecandlestickseries_p.h" +#include "declarativepieseries_p.h" +#include "declarativeaxes_p.h" #include #include #include #include #include #include -#include "declarativemargins.h" +#include "declarativemargins_p.h" #include #include #include diff --git a/src/chartsqml2/declarativeabstractrendernode.h b/src/chartsqml2/declarativeabstractrendernode.h deleted file mode 100644 index 34bd1d19..00000000 --- a/src/chartsqml2/declarativeabstractrendernode.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Charts module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVEABSTRACTRENDERNODE_H -#define DECLARATIVEABSTRACTRENDERNODE_H - -#include -#include -#include -#include - -QT_CHARTS_BEGIN_NAMESPACE - -class MouseEventResponse { -public: - enum MouseEventType { - None, - Pressed, - Released, - Clicked, - DoubleClicked, - HoverEnter, - HoverLeave - }; - - MouseEventResponse() - : type(None), - series(nullptr) {} - MouseEventResponse(MouseEventType t, const QPoint &p, const QXYSeries *s) - : type(t), - point(p), - series(s) {} - MouseEventType type; - QPoint point; - const QXYSeries *series; -}; - -class DeclarativeAbstractRenderNode : public QSGRootNode -{ -public: - DeclarativeAbstractRenderNode() {} - - virtual void setTextureSize(const QSize &textureSize) = 0; - virtual QSize textureSize() const = 0; - virtual void setRect(const QRectF &rect) = 0; - virtual void setSeriesData(bool mapDirty, const GLXYDataMap &dataMap) = 0; - virtual void setAntialiasing(bool enable) = 0; - virtual void addMouseEvents(const QVector &events) = 0; - virtual void takeMouseEventResponses(QVector &responses) = 0; -}; - -QT_CHARTS_END_NAMESPACE - - -#endif // DECLARATIVEABSTRACTRENDERNODE_H diff --git a/src/chartsqml2/declarativeabstractrendernode_p.h b/src/chartsqml2/declarativeabstractrendernode_p.h new file mode 100644 index 00000000..905b6385 --- /dev/null +++ b/src/chartsqml2/declarativeabstractrendernode_p.h @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the Qt Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef DECLARATIVEABSTRACTRENDERNODE_H +#define DECLARATIVEABSTRACTRENDERNODE_H + +#include +#include +#include +#include +#include + +QT_CHARTS_BEGIN_NAMESPACE + +class QT_QMLCHARTS_PRIVATE_EXPORT MouseEventResponse { +public: + enum MouseEventType { + None, + Pressed, + Released, + Clicked, + DoubleClicked, + HoverEnter, + HoverLeave + }; + + MouseEventResponse() + : type(None), + series(nullptr) {} + MouseEventResponse(MouseEventType t, const QPoint &p, const QXYSeries *s) + : type(t), + point(p), + series(s) {} + MouseEventType type; + QPoint point; + const QXYSeries *series; +}; + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativeAbstractRenderNode : public QSGRootNode +{ +public: + DeclarativeAbstractRenderNode() {} + + virtual void setTextureSize(const QSize &textureSize) = 0; + virtual QSize textureSize() const = 0; + virtual void setRect(const QRectF &rect) = 0; + virtual void setSeriesData(bool mapDirty, const GLXYDataMap &dataMap) = 0; + virtual void setAntialiasing(bool enable) = 0; + virtual void addMouseEvents(const QVector &events) = 0; + virtual void takeMouseEventResponses(QVector &responses) = 0; +}; + +QT_CHARTS_END_NAMESPACE + + +#endif // DECLARATIVEABSTRACTRENDERNODE_H diff --git a/src/chartsqml2/declarativeareaseries.cpp b/src/chartsqml2/declarativeareaseries.cpp index 73c5960a..be4b9037 100644 --- a/src/chartsqml2/declarativeareaseries.cpp +++ b/src/chartsqml2/declarativeareaseries.cpp @@ -27,8 +27,8 @@ ** ****************************************************************************/ -#include "declarativeareaseries.h" -#include "declarativelineseries.h" +#include "declarativeareaseries_p.h" +#include "declarativelineseries_p.h" QT_CHARTS_BEGIN_NAMESPACE @@ -119,6 +119,6 @@ QBrush DeclarativeAreaSeries::brush() const return QAreaSeries::brush(); } -#include "moc_declarativeareaseries.cpp" +#include "moc_declarativeareaseries_p.cpp" QT_CHARTS_END_NAMESPACE diff --git a/src/chartsqml2/declarativeareaseries.h b/src/chartsqml2/declarativeareaseries.h deleted file mode 100644 index 24dfcc8a..00000000 --- a/src/chartsqml2/declarativeareaseries.h +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Charts module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVEAREASERIES_H -#define DECLARATIVEAREASERIES_H - -#include -#include "declarativeaxes.h" - -QT_CHARTS_BEGIN_NAMESPACE -class DeclarativeLineSeries; - -class DeclarativeAreaSeries : public QAreaSeries -{ - Q_OBJECT - Q_PROPERTY(DeclarativeLineSeries *upperSeries READ upperSeries WRITE setUpperSeries) - Q_PROPERTY(DeclarativeLineSeries *lowerSeries READ lowerSeries WRITE setLowerSeries) - Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) - Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) - Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2) - Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2) - Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3) - Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3) - Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1) - Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 4) - Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged REVISION 4) - -public: - explicit DeclarativeAreaSeries(QObject *parent = 0); - void setUpperSeries(DeclarativeLineSeries *series); - DeclarativeLineSeries *upperSeries() const; - void setLowerSeries(DeclarativeLineSeries *series); - DeclarativeLineSeries *lowerSeries() const; - QAbstractAxis *axisX() { return m_axes->axisX(); } - void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } - QAbstractAxis *axisY() { return m_axes->axisY(); } - void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } - QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - QAbstractAxis *axisAngular() { return m_axes->axisX(); } - void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); } - QAbstractAxis *axisRadial() { return m_axes->axisY(); } - void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); } - qreal borderWidth() const; - void setBorderWidth(qreal borderWidth); - QString brushFilename() const; - void setBrushFilename(const QString &brushFilename); - void setBrush(const QBrush &brush); - QBrush brush() const; - -Q_SIGNALS: - Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); - Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); - Q_REVISION(1) void borderWidthChanged(qreal width); - Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis); - Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis); - Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis); - Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis); - Q_REVISION(4) void brushChanged(); - Q_REVISION(4) void brushFilenameChanged(const QString &brushFilename); - -private Q_SLOTS: - void handleBrushChanged(); - -public: - DeclarativeAxes *m_axes; - -private: - QString m_brushFilename; - QImage m_brushImage; -}; - -QT_CHARTS_END_NAMESPACE - -#endif // DECLARATIVEAREASERIES_H diff --git a/src/chartsqml2/declarativeareaseries_p.h b/src/chartsqml2/declarativeareaseries_p.h new file mode 100644 index 00000000..b2c884be --- /dev/null +++ b/src/chartsqml2/declarativeareaseries_p.h @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the Qt Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef DECLARATIVEAREASERIES_H +#define DECLARATIVEAREASERIES_H + +#include +#include +#include + +QT_CHARTS_BEGIN_NAMESPACE +class DeclarativeLineSeries; + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativeAreaSeries : public QAreaSeries +{ + Q_OBJECT + Q_PROPERTY(DeclarativeLineSeries *upperSeries READ upperSeries WRITE setUpperSeries) + Q_PROPERTY(DeclarativeLineSeries *lowerSeries READ lowerSeries WRITE setLowerSeries) + Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) + Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) + Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2) + Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2) + Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3) + Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3) + Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1) + Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 4) + Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged REVISION 4) + +public: + explicit DeclarativeAreaSeries(QObject *parent = 0); + void setUpperSeries(DeclarativeLineSeries *series); + DeclarativeLineSeries *upperSeries() const; + void setLowerSeries(DeclarativeLineSeries *series); + DeclarativeLineSeries *lowerSeries() const; + QAbstractAxis *axisX() { return m_axes->axisX(); } + void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } + QAbstractAxis *axisY() { return m_axes->axisY(); } + void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } + QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } + void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } + QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } + void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } + QAbstractAxis *axisAngular() { return m_axes->axisX(); } + void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); } + QAbstractAxis *axisRadial() { return m_axes->axisY(); } + void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); } + qreal borderWidth() const; + void setBorderWidth(qreal borderWidth); + QString brushFilename() const; + void setBrushFilename(const QString &brushFilename); + void setBrush(const QBrush &brush); + QBrush brush() const; + +Q_SIGNALS: + Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); + Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); + Q_REVISION(1) void borderWidthChanged(qreal width); + Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis); + Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis); + Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis); + Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis); + Q_REVISION(4) void brushChanged(); + Q_REVISION(4) void brushFilenameChanged(const QString &brushFilename); + +private Q_SLOTS: + void handleBrushChanged(); + +public: + DeclarativeAxes *m_axes; + +private: + QString m_brushFilename; + QImage m_brushImage; +}; + +QT_CHARTS_END_NAMESPACE + +#endif // DECLARATIVEAREASERIES_H diff --git a/src/chartsqml2/declarativeaxes.cpp b/src/chartsqml2/declarativeaxes.cpp index 231f9c6e..334744c0 100644 --- a/src/chartsqml2/declarativeaxes.cpp +++ b/src/chartsqml2/declarativeaxes.cpp @@ -27,7 +27,7 @@ ** ****************************************************************************/ -#include "declarativeaxes.h" +#include "declarativeaxes_p.h" #include QT_CHARTS_BEGIN_NAMESPACE @@ -65,6 +65,6 @@ void DeclarativeAxes::setAxisYRight(QAbstractAxis *axis) emit axisYRightChanged(axis); } -#include "moc_declarativeaxes.cpp" +#include "moc_declarativeaxes_p.cpp" QT_CHARTS_END_NAMESPACE diff --git a/src/chartsqml2/declarativeaxes.h b/src/chartsqml2/declarativeaxes.h deleted file mode 100644 index 1115ee60..00000000 --- a/src/chartsqml2/declarativeaxes.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Charts module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVEAXES_H -#define DECLARATIVEAXES_H - -#include -#include - -QT_CHARTS_BEGIN_NAMESPACE - -class QAbstractAxis; - -class DeclarativeAxes : public QObject -{ - Q_OBJECT - Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged) - Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged) - Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged) - Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged) - -public: - explicit DeclarativeAxes(QObject *parent = 0); - - QAbstractAxis *axisX() { return m_axisX; } - void setAxisX(QAbstractAxis *axis); - QAbstractAxis *axisY() { return m_axisY; } - void setAxisY(QAbstractAxis *axis); - QAbstractAxis *axisXTop() { return m_axisXTop; } - void setAxisXTop(QAbstractAxis *axis); - QAbstractAxis *axisYRight() { return m_axisYRight; } - void setAxisYRight(QAbstractAxis *axis); - -public: - void emitAxisXChanged() { emit axisXChanged(m_axisX); } - void emitAxisYChanged() { emit axisYChanged(m_axisY); } - void emitAxisXTopChanged() { emit axisXTopChanged(m_axisXTop); } - void emitAxisYRightChanged() { emit axisYRightChanged(m_axisYRight); } - -Q_SIGNALS: - void axisXChanged(QAbstractAxis *axis); - void axisYChanged(QAbstractAxis *axis); - void axisXTopChanged(QAbstractAxis *axis); - void axisYRightChanged(QAbstractAxis *axis); - -private: - QAbstractAxis *m_axisX; - QAbstractAxis *m_axisY; - QAbstractAxis *m_axisXTop; - QAbstractAxis *m_axisYRight; -}; - -QT_CHARTS_END_NAMESPACE - -#endif // DECLARATIVEAXES_H diff --git a/src/chartsqml2/declarativeaxes_p.h b/src/chartsqml2/declarativeaxes_p.h new file mode 100644 index 00000000..af5b13c2 --- /dev/null +++ b/src/chartsqml2/declarativeaxes_p.h @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the Qt Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef DECLARATIVEAXES_H +#define DECLARATIVEAXES_H + +#include +#include +#include + +QT_CHARTS_BEGIN_NAMESPACE + +class QAbstractAxis; + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativeAxes : public QObject +{ + Q_OBJECT + Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged) + Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged) + Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged) + Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged) + +public: + explicit DeclarativeAxes(QObject *parent = 0); + + QAbstractAxis *axisX() { return m_axisX; } + void setAxisX(QAbstractAxis *axis); + QAbstractAxis *axisY() { return m_axisY; } + void setAxisY(QAbstractAxis *axis); + QAbstractAxis *axisXTop() { return m_axisXTop; } + void setAxisXTop(QAbstractAxis *axis); + QAbstractAxis *axisYRight() { return m_axisYRight; } + void setAxisYRight(QAbstractAxis *axis); + +public: + void emitAxisXChanged() { emit axisXChanged(m_axisX); } + void emitAxisYChanged() { emit axisYChanged(m_axisY); } + void emitAxisXTopChanged() { emit axisXTopChanged(m_axisXTop); } + void emitAxisYRightChanged() { emit axisYRightChanged(m_axisYRight); } + +Q_SIGNALS: + void axisXChanged(QAbstractAxis *axis); + void axisYChanged(QAbstractAxis *axis); + void axisXTopChanged(QAbstractAxis *axis); + void axisYRightChanged(QAbstractAxis *axis); + +private: + QAbstractAxis *m_axisX; + QAbstractAxis *m_axisY; + QAbstractAxis *m_axisXTop; + QAbstractAxis *m_axisYRight; +}; + +QT_CHARTS_END_NAMESPACE + +#endif // DECLARATIVEAXES_H diff --git a/src/chartsqml2/declarativebarseries.cpp b/src/chartsqml2/declarativebarseries.cpp index d335f9d5..36a811bb 100644 --- a/src/chartsqml2/declarativebarseries.cpp +++ b/src/chartsqml2/declarativebarseries.cpp @@ -27,7 +27,7 @@ ** ****************************************************************************/ -#include "declarativebarseries.h" +#include "declarativebarseries_p.h" #include #include #include @@ -513,6 +513,6 @@ DeclarativeBarSet *DeclarativeHorizontalPercentBarSeries::insert(int index, QStr return 0; } -#include "moc_declarativebarseries.cpp" +#include "moc_declarativebarseries_p.cpp" QT_CHARTS_END_NAMESPACE diff --git a/src/chartsqml2/declarativebarseries.h b/src/chartsqml2/declarativebarseries.h deleted file mode 100644 index 15ed554c..00000000 --- a/src/chartsqml2/declarativebarseries.h +++ /dev/null @@ -1,370 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Charts module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVEBARSERIES_H -#define DECLARATIVEBARSERIES_H - -#include -#include -#include -#include -#include -#include -#include -#include "declarativeaxes.h" - -#include -#include - -QT_CHARTS_BEGIN_NAMESPACE - -class QChart; - -class DeclarativeBarSet : public QBarSet -{ - Q_OBJECT - Q_PROPERTY(QVariantList values READ values WRITE setValues) - Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1) - Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 2) - -public: - explicit DeclarativeBarSet(QObject *parent = 0); - QVariantList values(); - void setValues(QVariantList values); - qreal borderWidth() const; - void setBorderWidth(qreal borderWidth); - QString brushFilename() const; - void setBrushFilename(const QString &brushFilename); - -public: // From QBarSet - Q_INVOKABLE void append(qreal value) { QBarSet::append(value); } - Q_INVOKABLE void remove(const int index, const int count = 1) { QBarSet::remove(index, count); } - Q_INVOKABLE void replace(int index, qreal value) { QBarSet::replace(index, value); } - Q_INVOKABLE qreal at(int index) { return QBarSet::at(index); } - -Q_SIGNALS: - void countChanged(int count); - Q_REVISION(1) void borderWidthChanged(qreal width); - Q_REVISION(2) void brushFilenameChanged(const QString &brushFilename); - -private Q_SLOTS: - void handleCountChanged(int index, int count); - void handleBrushChanged(); - -private: - QString m_brushFilename; - QImage m_brushImage; -}; - -class DeclarativeBarSeries : public QBarSeries, public QQmlParserStatus -{ - Q_OBJECT - Q_INTERFACES(QQmlParserStatus) - Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) - Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) - Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2) - Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2) - Q_PROPERTY(QQmlListProperty seriesChildren READ seriesChildren) - Q_CLASSINFO("DefaultProperty", "seriesChildren") - -public: - explicit DeclarativeBarSeries(QQuickItem *parent = 0); - QAbstractAxis *axisX() { return m_axes->axisX(); } - void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } - QAbstractAxis *axisY() { return m_axes->axisY(); } - void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } - QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - QQmlListProperty seriesChildren(); - -public: - Q_INVOKABLE DeclarativeBarSet *at(int index); - Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); } - Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values); - Q_INVOKABLE bool remove(QBarSet *barset) { return QBarSeries::remove(barset); } - Q_INVOKABLE void clear() { return QBarSeries::clear(); } - -public: // from QDeclarativeParserStatus - void classBegin(); - void componentComplete(); - -Q_SIGNALS: - Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); - Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); - Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis); - Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis); - -public Q_SLOTS: - static void appendSeriesChildren(QQmlListProperty *list, QObject *element); - -public: - DeclarativeAxes *m_axes; -}; - -class DeclarativeStackedBarSeries : public QStackedBarSeries, public QQmlParserStatus -{ - Q_OBJECT - Q_INTERFACES(QQmlParserStatus) - Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) - Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) - Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2) - Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2) - Q_PROPERTY(QQmlListProperty seriesChildren READ seriesChildren) - Q_CLASSINFO("DefaultProperty", "seriesChildren") - -public: - explicit DeclarativeStackedBarSeries(QQuickItem *parent = 0); - QAbstractAxis *axisX() { return m_axes->axisX(); } - void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } - QAbstractAxis *axisY() { return m_axes->axisY(); } - void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } - QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - QQmlListProperty seriesChildren(); - -public: - Q_INVOKABLE DeclarativeBarSet *at(int index); - Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); } - Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values); - Q_INVOKABLE bool remove(QBarSet *barset) { return QStackedBarSeries::remove(barset); } - Q_INVOKABLE void clear() { return QStackedBarSeries::clear(); } - -public: // from QDeclarativeParserStatus - void classBegin(); - void componentComplete(); - -Q_SIGNALS: - Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); - Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); - Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis); - Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis); - -public Q_SLOTS: - static void appendSeriesChildren(QQmlListProperty *list, QObject *element); - -public: - DeclarativeAxes *m_axes; -}; - -class DeclarativePercentBarSeries : public QPercentBarSeries, public QQmlParserStatus -{ - Q_OBJECT - Q_INTERFACES(QQmlParserStatus) - Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) - Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) - Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2) - Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2) - Q_PROPERTY(QQmlListProperty seriesChildren READ seriesChildren) - Q_CLASSINFO("DefaultProperty", "seriesChildren") - -public: - explicit DeclarativePercentBarSeries(QQuickItem *parent = 0); - QAbstractAxis *axisX() { return m_axes->axisX(); } - void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } - QAbstractAxis *axisY() { return m_axes->axisY(); } - void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } - QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - QQmlListProperty seriesChildren(); - -public: - Q_INVOKABLE DeclarativeBarSet *at(int index); - Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); } - Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values); - Q_INVOKABLE bool remove(QBarSet *barset) { return QPercentBarSeries::remove(barset); } - Q_INVOKABLE void clear() { return QPercentBarSeries::clear(); } - -public: // from QDeclarativeParserStatus - void classBegin(); - void componentComplete(); - -Q_SIGNALS: - Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); - Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); - Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis); - Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis); - -public Q_SLOTS: - static void appendSeriesChildren(QQmlListProperty *list, QObject *element); - -public: - DeclarativeAxes *m_axes; -}; - -class DeclarativeHorizontalBarSeries : public QHorizontalBarSeries, public QQmlParserStatus -{ - Q_OBJECT - Q_INTERFACES(QQmlParserStatus) - Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) - Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) - Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2) - Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2) - Q_PROPERTY(QQmlListProperty seriesChildren READ seriesChildren) - Q_CLASSINFO("DefaultProperty", "seriesChildren") - -public: - explicit DeclarativeHorizontalBarSeries(QQuickItem *parent = 0); - QAbstractAxis *axisX() { return m_axes->axisX(); } - void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } - QAbstractAxis *axisY() { return m_axes->axisY(); } - void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } - QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - QQmlListProperty seriesChildren(); - -public: - Q_INVOKABLE DeclarativeBarSet *at(int index); - Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); } - Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values); - Q_INVOKABLE bool remove(QBarSet *barset) { return QHorizontalBarSeries::remove(barset); } - Q_INVOKABLE void clear() { return QHorizontalBarSeries::clear(); } - -public: // from QDeclarativeParserStatus - void classBegin(); - void componentComplete(); - -Q_SIGNALS: - Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); - Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); - Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis); - Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis); - -public Q_SLOTS: - static void appendSeriesChildren(QQmlListProperty *list, QObject *element); - -public: - DeclarativeAxes *m_axes; -}; - -class DeclarativeHorizontalStackedBarSeries : public QHorizontalStackedBarSeries, public QQmlParserStatus -{ - Q_OBJECT - Q_INTERFACES(QQmlParserStatus) - Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) - Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) - Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2) - Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2) - Q_PROPERTY(QQmlListProperty seriesChildren READ seriesChildren) - Q_CLASSINFO("DefaultProperty", "seriesChildren") - -public: - explicit DeclarativeHorizontalStackedBarSeries(QQuickItem *parent = 0); - QAbstractAxis *axisX() { return m_axes->axisX(); } - void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } - QAbstractAxis *axisY() { return m_axes->axisY(); } - void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } - QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - QQmlListProperty seriesChildren(); - -public: - Q_INVOKABLE DeclarativeBarSet *at(int index); - Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); } - Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values); - Q_INVOKABLE bool remove(QBarSet *barset) { return QHorizontalStackedBarSeries::remove(barset); } - Q_INVOKABLE void clear() { return QHorizontalStackedBarSeries::clear(); } - -public: // from QDeclarativeParserStatus - void classBegin(); - void componentComplete(); - -Q_SIGNALS: - Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); - Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); - Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis); - Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis); - -public Q_SLOTS: - static void appendSeriesChildren(QQmlListProperty *list, QObject *element); - -public: - DeclarativeAxes *m_axes; -}; - -class DeclarativeHorizontalPercentBarSeries : public QHorizontalPercentBarSeries, public QQmlParserStatus -{ - Q_OBJECT - Q_INTERFACES(QQmlParserStatus) - Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) - Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) - Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2) - Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2) - Q_PROPERTY(QQmlListProperty seriesChildren READ seriesChildren) - Q_CLASSINFO("DefaultProperty", "seriesChildren") - -public: - explicit DeclarativeHorizontalPercentBarSeries(QQuickItem *parent = 0); - QAbstractAxis *axisX() { return m_axes->axisX(); } - void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } - QAbstractAxis *axisY() { return m_axes->axisY(); } - void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } - QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - QQmlListProperty seriesChildren(); - -public: - Q_INVOKABLE DeclarativeBarSet *at(int index); - Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); } - Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values); - Q_INVOKABLE bool remove(QBarSet *barset) { return QHorizontalPercentBarSeries::remove(barset); } - Q_INVOKABLE void clear() { return QHorizontalPercentBarSeries::clear(); } - -public: // from QDeclarativeParserStatus - void classBegin(); - void componentComplete(); - -Q_SIGNALS: - Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); - Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); - Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis); - Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis); - -public Q_SLOTS: - static void appendSeriesChildren(QQmlListProperty *list, QObject *element); - -public: - DeclarativeAxes *m_axes; -}; - -QT_CHARTS_END_NAMESPACE - -#endif // DECLARATIVEBARSERIES_H diff --git a/src/chartsqml2/declarativebarseries_p.h b/src/chartsqml2/declarativebarseries_p.h new file mode 100644 index 00000000..a419fb04 --- /dev/null +++ b/src/chartsqml2/declarativebarseries_p.h @@ -0,0 +1,380 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the Qt Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef DECLARATIVEBARSERIES_H +#define DECLARATIVEBARSERIES_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +QT_CHARTS_BEGIN_NAMESPACE + +class QChart; + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativeBarSet : public QBarSet +{ + Q_OBJECT + Q_PROPERTY(QVariantList values READ values WRITE setValues) + Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1) + Q_PROPERTY(int count READ count NOTIFY countChanged) + Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 2) + +public: + explicit DeclarativeBarSet(QObject *parent = 0); + QVariantList values(); + void setValues(QVariantList values); + qreal borderWidth() const; + void setBorderWidth(qreal borderWidth); + QString brushFilename() const; + void setBrushFilename(const QString &brushFilename); + +public: // From QBarSet + Q_INVOKABLE void append(qreal value) { QBarSet::append(value); } + Q_INVOKABLE void remove(const int index, const int count = 1) { QBarSet::remove(index, count); } + Q_INVOKABLE void replace(int index, qreal value) { QBarSet::replace(index, value); } + Q_INVOKABLE qreal at(int index) { return QBarSet::at(index); } + +Q_SIGNALS: + void countChanged(int count); + Q_REVISION(1) void borderWidthChanged(qreal width); + Q_REVISION(2) void brushFilenameChanged(const QString &brushFilename); + +private Q_SLOTS: + void handleCountChanged(int index, int count); + void handleBrushChanged(); + +private: + QString m_brushFilename; + QImage m_brushImage; +}; + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativeBarSeries : public QBarSeries, public QQmlParserStatus +{ + Q_OBJECT + Q_INTERFACES(QQmlParserStatus) + Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) + Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) + Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2) + Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2) + Q_PROPERTY(QQmlListProperty seriesChildren READ seriesChildren) + Q_CLASSINFO("DefaultProperty", "seriesChildren") + +public: + explicit DeclarativeBarSeries(QQuickItem *parent = 0); + QAbstractAxis *axisX() { return m_axes->axisX(); } + void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } + QAbstractAxis *axisY() { return m_axes->axisY(); } + void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } + QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } + void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } + QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } + void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } + QQmlListProperty seriesChildren(); + +public: + Q_INVOKABLE DeclarativeBarSet *at(int index); + Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); } + Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values); + Q_INVOKABLE bool remove(QBarSet *barset) { return QBarSeries::remove(barset); } + Q_INVOKABLE void clear() { return QBarSeries::clear(); } + +public: // from QDeclarativeParserStatus + void classBegin(); + void componentComplete(); + +Q_SIGNALS: + Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); + Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); + Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis); + Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis); + +public Q_SLOTS: + static void appendSeriesChildren(QQmlListProperty *list, QObject *element); + +public: + DeclarativeAxes *m_axes; +}; + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativeStackedBarSeries : public QStackedBarSeries, public QQmlParserStatus +{ + Q_OBJECT + Q_INTERFACES(QQmlParserStatus) + Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) + Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) + Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2) + Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2) + Q_PROPERTY(QQmlListProperty seriesChildren READ seriesChildren) + Q_CLASSINFO("DefaultProperty", "seriesChildren") + +public: + explicit DeclarativeStackedBarSeries(QQuickItem *parent = 0); + QAbstractAxis *axisX() { return m_axes->axisX(); } + void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } + QAbstractAxis *axisY() { return m_axes->axisY(); } + void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } + QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } + void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } + QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } + void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } + QQmlListProperty seriesChildren(); + +public: + Q_INVOKABLE DeclarativeBarSet *at(int index); + Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); } + Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values); + Q_INVOKABLE bool remove(QBarSet *barset) { return QStackedBarSeries::remove(barset); } + Q_INVOKABLE void clear() { return QStackedBarSeries::clear(); } + +public: // from QDeclarativeParserStatus + void classBegin(); + void componentComplete(); + +Q_SIGNALS: + Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); + Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); + Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis); + Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis); + +public Q_SLOTS: + static void appendSeriesChildren(QQmlListProperty *list, QObject *element); + +public: + DeclarativeAxes *m_axes; +}; + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativePercentBarSeries : public QPercentBarSeries, public QQmlParserStatus +{ + Q_OBJECT + Q_INTERFACES(QQmlParserStatus) + Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) + Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) + Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2) + Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2) + Q_PROPERTY(QQmlListProperty seriesChildren READ seriesChildren) + Q_CLASSINFO("DefaultProperty", "seriesChildren") + +public: + explicit DeclarativePercentBarSeries(QQuickItem *parent = 0); + QAbstractAxis *axisX() { return m_axes->axisX(); } + void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } + QAbstractAxis *axisY() { return m_axes->axisY(); } + void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } + QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } + void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } + QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } + void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } + QQmlListProperty seriesChildren(); + +public: + Q_INVOKABLE DeclarativeBarSet *at(int index); + Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); } + Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values); + Q_INVOKABLE bool remove(QBarSet *barset) { return QPercentBarSeries::remove(barset); } + Q_INVOKABLE void clear() { return QPercentBarSeries::clear(); } + +public: // from QDeclarativeParserStatus + void classBegin(); + void componentComplete(); + +Q_SIGNALS: + Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); + Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); + Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis); + Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis); + +public Q_SLOTS: + static void appendSeriesChildren(QQmlListProperty *list, QObject *element); + +public: + DeclarativeAxes *m_axes; +}; + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativeHorizontalBarSeries : public QHorizontalBarSeries, public QQmlParserStatus +{ + Q_OBJECT + Q_INTERFACES(QQmlParserStatus) + Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) + Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) + Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2) + Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2) + Q_PROPERTY(QQmlListProperty seriesChildren READ seriesChildren) + Q_CLASSINFO("DefaultProperty", "seriesChildren") + +public: + explicit DeclarativeHorizontalBarSeries(QQuickItem *parent = 0); + QAbstractAxis *axisX() { return m_axes->axisX(); } + void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } + QAbstractAxis *axisY() { return m_axes->axisY(); } + void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } + QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } + void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } + QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } + void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } + QQmlListProperty seriesChildren(); + +public: + Q_INVOKABLE DeclarativeBarSet *at(int index); + Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); } + Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values); + Q_INVOKABLE bool remove(QBarSet *barset) { return QHorizontalBarSeries::remove(barset); } + Q_INVOKABLE void clear() { return QHorizontalBarSeries::clear(); } + +public: // from QDeclarativeParserStatus + void classBegin(); + void componentComplete(); + +Q_SIGNALS: + Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); + Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); + Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis); + Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis); + +public Q_SLOTS: + static void appendSeriesChildren(QQmlListProperty *list, QObject *element); + +public: + DeclarativeAxes *m_axes; +}; + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativeHorizontalStackedBarSeries : public QHorizontalStackedBarSeries, public QQmlParserStatus +{ + Q_OBJECT + Q_INTERFACES(QQmlParserStatus) + Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) + Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) + Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2) + Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2) + Q_PROPERTY(QQmlListProperty seriesChildren READ seriesChildren) + Q_CLASSINFO("DefaultProperty", "seriesChildren") + +public: + explicit DeclarativeHorizontalStackedBarSeries(QQuickItem *parent = 0); + QAbstractAxis *axisX() { return m_axes->axisX(); } + void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } + QAbstractAxis *axisY() { return m_axes->axisY(); } + void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } + QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } + void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } + QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } + void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } + QQmlListProperty seriesChildren(); + +public: + Q_INVOKABLE DeclarativeBarSet *at(int index); + Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); } + Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values); + Q_INVOKABLE bool remove(QBarSet *barset) { return QHorizontalStackedBarSeries::remove(barset); } + Q_INVOKABLE void clear() { return QHorizontalStackedBarSeries::clear(); } + +public: // from QDeclarativeParserStatus + void classBegin(); + void componentComplete(); + +Q_SIGNALS: + Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); + Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); + Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis); + Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis); + +public Q_SLOTS: + static void appendSeriesChildren(QQmlListProperty *list, QObject *element); + +public: + DeclarativeAxes *m_axes; +}; + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativeHorizontalPercentBarSeries : public QHorizontalPercentBarSeries, public QQmlParserStatus +{ + Q_OBJECT + Q_INTERFACES(QQmlParserStatus) + Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) + Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) + Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2) + Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2) + Q_PROPERTY(QQmlListProperty seriesChildren READ seriesChildren) + Q_CLASSINFO("DefaultProperty", "seriesChildren") + +public: + explicit DeclarativeHorizontalPercentBarSeries(QQuickItem *parent = 0); + QAbstractAxis *axisX() { return m_axes->axisX(); } + void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } + QAbstractAxis *axisY() { return m_axes->axisY(); } + void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } + QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } + void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } + QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } + void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } + QQmlListProperty seriesChildren(); + +public: + Q_INVOKABLE DeclarativeBarSet *at(int index); + Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); } + Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values); + Q_INVOKABLE bool remove(QBarSet *barset) { return QHorizontalPercentBarSeries::remove(barset); } + Q_INVOKABLE void clear() { return QHorizontalPercentBarSeries::clear(); } + +public: // from QDeclarativeParserStatus + void classBegin(); + void componentComplete(); + +Q_SIGNALS: + Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); + Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); + Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis); + Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis); + +public Q_SLOTS: + static void appendSeriesChildren(QQmlListProperty *list, QObject *element); + +public: + DeclarativeAxes *m_axes; +}; + +QT_CHARTS_END_NAMESPACE + +#endif // DECLARATIVEBARSERIES_H diff --git a/src/chartsqml2/declarativeboxplotseries.cpp b/src/chartsqml2/declarativeboxplotseries.cpp index bbc2316d..98feea82 100644 --- a/src/chartsqml2/declarativeboxplotseries.cpp +++ b/src/chartsqml2/declarativeboxplotseries.cpp @@ -27,8 +27,8 @@ ** ****************************************************************************/ -#include "declarativebarseries.h" -#include "declarativeboxplotseries.h" +#include "declarativebarseries_p.h" +#include "declarativeboxplotseries_p.h" #include #include @@ -493,6 +493,6 @@ void DeclarativeBoxPlotSeries::handleBrushChanged() } } -#include "moc_declarativeboxplotseries.cpp" +#include "moc_declarativeboxplotseries_p.cpp" QT_CHARTS_END_NAMESPACE diff --git a/src/chartsqml2/declarativeboxplotseries.h b/src/chartsqml2/declarativeboxplotseries.h deleted file mode 100644 index a1f3177e..00000000 --- a/src/chartsqml2/declarativeboxplotseries.h +++ /dev/null @@ -1,157 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Charts module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVEBOXPLOT_H -#define DECLARATIVEBOXPLOT_H - -#include -#include "declarativeaxes.h" -#include - -#include -#include - -QT_CHARTS_BEGIN_NAMESPACE - -class DeclarativeBoxSet : public QBoxSet -{ - Q_OBJECT - Q_PROPERTY(QVariantList values READ values WRITE setValues) - Q_PROPERTY(QString label READ label WRITE setLabel) - Q_PROPERTY(int count READ count) - Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 1) - Q_ENUMS(ValuePositions) - -public: // duplicate from QBoxSet - enum ValuePositions { - LowerExtreme = 0x0, - LowerQuartile, - Median, - UpperQuartile, - UpperExtreme - }; - -public: - explicit DeclarativeBoxSet(const QString label = "", QObject *parent = 0); - QVariantList values(); - void setValues(QVariantList values); - QString brushFilename() const; - void setBrushFilename(const QString &brushFilename); - -public: // From QBoxSet - Q_INVOKABLE void append(qreal value) { QBoxSet::append(value); } - Q_INVOKABLE void clear() {QBoxSet::clear(); } - Q_INVOKABLE qreal at(int index) { return QBoxSet::at(index); } - Q_INVOKABLE void setValue(int index, qreal value) { QBoxSet::setValue(index, value); } - -Q_SIGNALS: - void changedValues(); - void changedValue(int index); - Q_REVISION(1) void brushFilenameChanged(const QString &brushFilename); - -private Q_SLOTS: - void handleBrushChanged(); - -private: - QString m_brushFilename; - QImage m_brushImage; -}; - -class DeclarativeBoxPlotSeries : public QBoxPlotSeries, public QQmlParserStatus -{ - Q_OBJECT - Q_INTERFACES(QQmlParserStatus) - Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged) - Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged) - Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged) - Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged) - Q_PROPERTY(QQmlListProperty seriesChildren READ seriesChildren) - Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 1) - Q_CLASSINFO("DefaultProperty", "seriesChildren") - -public: - explicit DeclarativeBoxPlotSeries(QQuickItem *parent = 0); - QAbstractAxis *axisX() { return m_axes->axisX(); } - void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } - QAbstractAxis *axisY() { return m_axes->axisY(); } - void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } - QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - QQmlListProperty seriesChildren(); - QString brushFilename() const; - void setBrushFilename(const QString &brushFilename); - -public: - Q_INVOKABLE DeclarativeBoxSet *at(int index); - Q_INVOKABLE DeclarativeBoxSet *append(const QString label, QVariantList values) { return insert(count(), label, values); } - Q_INVOKABLE void append(DeclarativeBoxSet *box) { QBoxPlotSeries::append(box); } - Q_INVOKABLE DeclarativeBoxSet *insert(int index, const QString label, QVariantList values); - Q_INVOKABLE bool remove(DeclarativeBoxSet *box) { return QBoxPlotSeries::remove(qobject_cast(box)); } - Q_INVOKABLE void clear() { return QBoxPlotSeries::clear(); } - -public: // from QDeclarativeParserStatus - void classBegin(); - void componentComplete(); - -Q_SIGNALS: - void axisXChanged(QAbstractAxis *axis); - void axisYChanged(QAbstractAxis *axis); - void axisXTopChanged(QAbstractAxis *axis); - void axisYRightChanged(QAbstractAxis *axis); - void clicked(DeclarativeBoxSet *boxset); - void hovered(bool status, DeclarativeBoxSet *boxset); - void pressed(DeclarativeBoxSet *boxset); - void released(DeclarativeBoxSet *boxset); - void doubleClicked(DeclarativeBoxSet *boxset); - Q_REVISION(1) void brushFilenameChanged(const QString &brushFilename); - -public Q_SLOTS: - static void appendSeriesChildren(QQmlListProperty *list, QObject *element); - void onHovered(bool status, QBoxSet *boxset); - void onClicked(QBoxSet *boxset); - void onPressed(QBoxSet *boxset); - void onReleased(QBoxSet *boxset); - void onDoubleClicked(QBoxSet *boxset); - -private Q_SLOTS: - void handleBrushChanged(); - -public: - DeclarativeAxes *m_axes; - -private: - QString m_brushFilename; - QImage m_brushImage; -}; - -QT_CHARTS_END_NAMESPACE - -#endif // DECLARATIVEBOXPLOT_H diff --git a/src/chartsqml2/declarativeboxplotseries_p.h b/src/chartsqml2/declarativeboxplotseries_p.h new file mode 100644 index 00000000..e035f8e2 --- /dev/null +++ b/src/chartsqml2/declarativeboxplotseries_p.h @@ -0,0 +1,167 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the Qt Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef DECLARATIVEBOXPLOT_H +#define DECLARATIVEBOXPLOT_H + +#include +#include +#include +#include + +#include +#include + +QT_CHARTS_BEGIN_NAMESPACE + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativeBoxSet : public QBoxSet +{ + Q_OBJECT + Q_PROPERTY(QVariantList values READ values WRITE setValues) + Q_PROPERTY(QString label READ label WRITE setLabel) + Q_PROPERTY(int count READ count) + Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 1) + Q_ENUMS(ValuePositions) + +public: // duplicate from QBoxSet + enum ValuePositions { + LowerExtreme = 0x0, + LowerQuartile, + Median, + UpperQuartile, + UpperExtreme + }; + +public: + explicit DeclarativeBoxSet(const QString label = "", QObject *parent = 0); + QVariantList values(); + void setValues(QVariantList values); + QString brushFilename() const; + void setBrushFilename(const QString &brushFilename); + +public: // From QBoxSet + Q_INVOKABLE void append(qreal value) { QBoxSet::append(value); } + Q_INVOKABLE void clear() {QBoxSet::clear(); } + Q_INVOKABLE qreal at(int index) { return QBoxSet::at(index); } + Q_INVOKABLE void setValue(int index, qreal value) { QBoxSet::setValue(index, value); } + +Q_SIGNALS: + void changedValues(); + void changedValue(int index); + Q_REVISION(1) void brushFilenameChanged(const QString &brushFilename); + +private Q_SLOTS: + void handleBrushChanged(); + +private: + QString m_brushFilename; + QImage m_brushImage; +}; + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativeBoxPlotSeries : public QBoxPlotSeries, public QQmlParserStatus +{ + Q_OBJECT + Q_INTERFACES(QQmlParserStatus) + Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged) + Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged) + Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged) + Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged) + Q_PROPERTY(QQmlListProperty seriesChildren READ seriesChildren) + Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 1) + Q_CLASSINFO("DefaultProperty", "seriesChildren") + +public: + explicit DeclarativeBoxPlotSeries(QQuickItem *parent = 0); + QAbstractAxis *axisX() { return m_axes->axisX(); } + void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } + QAbstractAxis *axisY() { return m_axes->axisY(); } + void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } + QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } + void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } + QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } + void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } + QQmlListProperty seriesChildren(); + QString brushFilename() const; + void setBrushFilename(const QString &brushFilename); + +public: + Q_INVOKABLE DeclarativeBoxSet *at(int index); + Q_INVOKABLE DeclarativeBoxSet *append(const QString label, QVariantList values) { return insert(count(), label, values); } + Q_INVOKABLE void append(DeclarativeBoxSet *box) { QBoxPlotSeries::append(box); } + Q_INVOKABLE DeclarativeBoxSet *insert(int index, const QString label, QVariantList values); + Q_INVOKABLE bool remove(DeclarativeBoxSet *box) { return QBoxPlotSeries::remove(qobject_cast(box)); } + Q_INVOKABLE void clear() { return QBoxPlotSeries::clear(); } + +public: // from QDeclarativeParserStatus + void classBegin(); + void componentComplete(); + +Q_SIGNALS: + void axisXChanged(QAbstractAxis *axis); + void axisYChanged(QAbstractAxis *axis); + void axisXTopChanged(QAbstractAxis *axis); + void axisYRightChanged(QAbstractAxis *axis); + void clicked(DeclarativeBoxSet *boxset); + void hovered(bool status, DeclarativeBoxSet *boxset); + void pressed(DeclarativeBoxSet *boxset); + void released(DeclarativeBoxSet *boxset); + void doubleClicked(DeclarativeBoxSet *boxset); + Q_REVISION(1) void brushFilenameChanged(const QString &brushFilename); + +public Q_SLOTS: + static void appendSeriesChildren(QQmlListProperty *list, QObject *element); + void onHovered(bool status, QBoxSet *boxset); + void onClicked(QBoxSet *boxset); + void onPressed(QBoxSet *boxset); + void onReleased(QBoxSet *boxset); + void onDoubleClicked(QBoxSet *boxset); + +private Q_SLOTS: + void handleBrushChanged(); + +public: + DeclarativeAxes *m_axes; + +private: + QString m_brushFilename; + QImage m_brushImage; +}; + +QT_CHARTS_END_NAMESPACE + +#endif // DECLARATIVEBOXPLOT_H diff --git a/src/chartsqml2/declarativecandlestickseries.cpp b/src/chartsqml2/declarativecandlestickseries.cpp index 66e6cdbc..97a5d557 100644 --- a/src/chartsqml2/declarativecandlestickseries.cpp +++ b/src/chartsqml2/declarativecandlestickseries.cpp @@ -29,8 +29,8 @@ #include #include -#include "declarativeaxes.h" -#include "declarativecandlestickseries.h" +#include "declarativeaxes_p.h" +#include "declarativecandlestickseries_p.h" QT_CHARTS_BEGIN_NAMESPACE @@ -239,6 +239,6 @@ void DeclarativeCandlestickSeries::handleBrushChanged() } } -#include "moc_declarativecandlestickseries.cpp" +#include "moc_declarativecandlestickseries_p.cpp" QT_CHARTS_END_NAMESPACE diff --git a/src/chartsqml2/declarativecandlestickseries.h b/src/chartsqml2/declarativecandlestickseries.h deleted file mode 100644 index 9b7c0e37..00000000 --- a/src/chartsqml2/declarativecandlestickseries.h +++ /dev/null @@ -1,136 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Charts module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVECANDLESTICKSERIES_H -#define DECLARATIVECANDLESTICKSERIES_H - -#include -#include -#include -#include - -QT_CHARTS_BEGIN_NAMESPACE - -class DeclarativeAxes; -class QAbstractAxis; - -class DeclarativeCandlestickSet : public QCandlestickSet -{ - Q_OBJECT - Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged) - -public: - explicit DeclarativeCandlestickSet(qreal timestamp = 0.0, QObject *parent = nullptr); - void setBrushFilename(const QString &brushFilename); - QString brushFilename() const; - -Q_SIGNALS: - void brushFilenameChanged(const QString &brushFilename); - -private Q_SLOTS: - void handleBrushChanged(); - -private: - QString m_brushFilename; - QImage m_brushImage; -}; - -class DeclarativeCandlestickSeries : public QCandlestickSeries, public QQmlParserStatus -{ - Q_OBJECT - Q_INTERFACES(QQmlParserStatus) - Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged) - Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged) - Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged) - Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged) - Q_PROPERTY(QQmlListProperty seriesChildren READ seriesChildren) - Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged) - Q_CLASSINFO("DefaultProperty", "seriesChildren") - -public: - explicit DeclarativeCandlestickSeries(QQuickItem *parent = nullptr); - void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } - QAbstractAxis *axisX() { return m_axes->axisX(); } - void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } - QAbstractAxis *axisY() { return m_axes->axisY(); } - void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - QQmlListProperty seriesChildren(); - void setBrushFilename(const QString &brushFilename); - QString brushFilename() const; - -public: - Q_INVOKABLE DeclarativeCandlestickSet *at(int index); - Q_INVOKABLE bool append(DeclarativeCandlestickSet *set); - Q_INVOKABLE bool remove(DeclarativeCandlestickSet *set); - Q_INVOKABLE bool append(qreal open, qreal high, qreal low, qreal close, qreal timestamp); - Q_INVOKABLE bool remove(qreal timestamp); - Q_INVOKABLE bool insert(int index, DeclarativeCandlestickSet *set); - Q_INVOKABLE void clear(); - -public: // from QDeclarativeParserStatus - void classBegin(); - void componentComplete(); - -Q_SIGNALS: - void axisXChanged(QAbstractAxis *axis); - void axisYChanged(QAbstractAxis *axis); - void axisXTopChanged(QAbstractAxis *axis); - void axisYRightChanged(QAbstractAxis *axis); - void clicked(DeclarativeCandlestickSet *set); - void hovered(bool status, DeclarativeCandlestickSet *set); - void pressed(DeclarativeCandlestickSet *set); - void released(DeclarativeCandlestickSet *set); - void doubleClicked(DeclarativeCandlestickSet *set); - void brushFilenameChanged(const QString &brushFilename); - -public Q_SLOTS: - static void appendSeriesChildren(QQmlListProperty *list, QObject *element); - void onClicked(QCandlestickSet *set); - void onHovered(bool status, QCandlestickSet *set); - void onPressed(QCandlestickSet *set); - void onReleased(QCandlestickSet *set); - void onDoubleClicked(QCandlestickSet *set); - -private Q_SLOTS: - void handleBrushChanged(); - -public: - DeclarativeAxes *m_axes; - -private: - QString m_brushFilename; - QImage m_brushImage; -}; - -QT_CHARTS_END_NAMESPACE - -#endif // DECLARATIVECANDLESTICKSERIES_H diff --git a/src/chartsqml2/declarativecandlestickseries_p.h b/src/chartsqml2/declarativecandlestickseries_p.h new file mode 100644 index 00000000..96787de2 --- /dev/null +++ b/src/chartsqml2/declarativecandlestickseries_p.h @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the Qt Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef DECLARATIVECANDLESTICKSERIES_H +#define DECLARATIVECANDLESTICKSERIES_H + +#include +#include +#include +#include +#include + +QT_CHARTS_BEGIN_NAMESPACE + +class DeclarativeAxes; +class QAbstractAxis; + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativeCandlestickSet : public QCandlestickSet +{ + Q_OBJECT + Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged) + +public: + explicit DeclarativeCandlestickSet(qreal timestamp = 0.0, QObject *parent = nullptr); + void setBrushFilename(const QString &brushFilename); + QString brushFilename() const; + +Q_SIGNALS: + void brushFilenameChanged(const QString &brushFilename); + +private Q_SLOTS: + void handleBrushChanged(); + +private: + QString m_brushFilename; + QImage m_brushImage; +}; + +class DeclarativeCandlestickSeries : public QCandlestickSeries, public QQmlParserStatus +{ + Q_OBJECT + Q_INTERFACES(QQmlParserStatus) + Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged) + Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged) + Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged) + Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged) + Q_PROPERTY(QQmlListProperty seriesChildren READ seriesChildren) + Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged) + Q_CLASSINFO("DefaultProperty", "seriesChildren") + +public: + explicit DeclarativeCandlestickSeries(QQuickItem *parent = nullptr); + void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } + QAbstractAxis *axisX() { return m_axes->axisX(); } + void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } + QAbstractAxis *axisY() { return m_axes->axisY(); } + void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } + QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } + void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } + QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } + QQmlListProperty seriesChildren(); + void setBrushFilename(const QString &brushFilename); + QString brushFilename() const; + +public: + Q_INVOKABLE DeclarativeCandlestickSet *at(int index); + Q_INVOKABLE bool append(DeclarativeCandlestickSet *set); + Q_INVOKABLE bool remove(DeclarativeCandlestickSet *set); + Q_INVOKABLE bool append(qreal open, qreal high, qreal low, qreal close, qreal timestamp); + Q_INVOKABLE bool remove(qreal timestamp); + Q_INVOKABLE bool insert(int index, DeclarativeCandlestickSet *set); + Q_INVOKABLE void clear(); + +public: // from QDeclarativeParserStatus + void classBegin(); + void componentComplete(); + +Q_SIGNALS: + void axisXChanged(QAbstractAxis *axis); + void axisYChanged(QAbstractAxis *axis); + void axisXTopChanged(QAbstractAxis *axis); + void axisYRightChanged(QAbstractAxis *axis); + void clicked(DeclarativeCandlestickSet *set); + void hovered(bool status, DeclarativeCandlestickSet *set); + void pressed(DeclarativeCandlestickSet *set); + void released(DeclarativeCandlestickSet *set); + void doubleClicked(DeclarativeCandlestickSet *set); + void brushFilenameChanged(const QString &brushFilename); + +public Q_SLOTS: + static void appendSeriesChildren(QQmlListProperty *list, QObject *element); + void onClicked(QCandlestickSet *set); + void onHovered(bool status, QCandlestickSet *set); + void onPressed(QCandlestickSet *set); + void onReleased(QCandlestickSet *set); + void onDoubleClicked(QCandlestickSet *set); + +private Q_SLOTS: + void handleBrushChanged(); + +public: + DeclarativeAxes *m_axes; + +private: + QString m_brushFilename; + QImage m_brushImage; +}; + +QT_CHARTS_END_NAMESPACE + +#endif // DECLARATIVECANDLESTICKSERIES_H diff --git a/src/chartsqml2/declarativecategoryaxis.cpp b/src/chartsqml2/declarativecategoryaxis.cpp index 21221404..dcfc928d 100644 --- a/src/chartsqml2/declarativecategoryaxis.cpp +++ b/src/chartsqml2/declarativecategoryaxis.cpp @@ -27,7 +27,7 @@ ** ****************************************************************************/ -#include "declarativecategoryaxis.h" +#include "declarativecategoryaxis_p.h" #include QT_CHARTS_BEGIN_NAMESPACE @@ -133,6 +133,6 @@ void DeclarativeCategoryAxis::setLabelsPosition(AxisLabelsPosition position) } } -#include "moc_declarativecategoryaxis.cpp" +#include "moc_declarativecategoryaxis_p.cpp" QT_CHARTS_END_NAMESPACE diff --git a/src/chartsqml2/declarativecategoryaxis.h b/src/chartsqml2/declarativecategoryaxis.h deleted file mode 100644 index 9f9ef90c..00000000 --- a/src/chartsqml2/declarativecategoryaxis.h +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Charts module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVECATEGORYAXIS_H -#define DECLARATIVECATEGORYAXIS_H - -#include - -#include -#include - -QT_CHARTS_BEGIN_NAMESPACE - -class DeclarativeCategoryRange : public QObject -{ - Q_OBJECT - Q_PROPERTY(qreal endValue READ endValue WRITE setEndValue) - Q_PROPERTY(QString label READ label WRITE setLabel) - -public: - explicit DeclarativeCategoryRange(QObject *parent = 0); - qreal endValue() { return m_endValue; } - void setEndValue(qreal endValue) { m_endValue = endValue; } - QString label() { return m_label; } - void setLabel(QString label) { m_label = label; } - -private: - qreal m_endValue; - QString m_label; -}; - -class DeclarativeCategoryAxis : public QCategoryAxis, public QQmlParserStatus -{ - Q_OBJECT - Q_INTERFACES(QQmlParserStatus) - Q_PROPERTY(QQmlListProperty axisChildren READ axisChildren) - Q_CLASSINFO("DefaultProperty", "axisChildren") - Q_PROPERTY(AxisLabelsPosition labelsPosition READ labelsPosition WRITE setLabelsPosition NOTIFY labelsPositionChanged REVISION 1) - Q_ENUMS(AxisLabelsPosition) - -public: - // duplicating enums from QChart to make the QML api namings 1-to-1 with the C++ api - enum AxisLabelsPosition { - AxisLabelsPositionCenter = 0x0, - AxisLabelsPositionOnValue = 0x1 - }; - - explicit DeclarativeCategoryAxis(QObject *parent = 0); - QQmlListProperty axisChildren(); - - -public: // from QDeclarativeParserStatus - void classBegin(); - void componentComplete(); - -public: - AxisLabelsPosition labelsPosition() const; - void setLabelsPosition(AxisLabelsPosition position); - -Q_SIGNALS: - Q_REVISION(1) void labelsPositionChanged(AxisLabelsPosition position); - -public Q_SLOTS: - Q_INVOKABLE void append(const QString &label, qreal categoryEndValue); - Q_INVOKABLE void remove(const QString &label); - Q_INVOKABLE void replace(const QString &oldLabel, const QString &newLabel); - static void appendAxisChildren(QQmlListProperty *list, QObject *element); - -private: - static bool endValueLessThan(const QPair &value1, const QPair &value2); - -private: - AxisLabelsPosition m_labelsPosition; -}; - -QT_CHARTS_END_NAMESPACE - -#endif // DECLARATIVECATEGORYAXIS_H diff --git a/src/chartsqml2/declarativecategoryaxis_p.h b/src/chartsqml2/declarativecategoryaxis_p.h new file mode 100644 index 00000000..e50844b2 --- /dev/null +++ b/src/chartsqml2/declarativecategoryaxis_p.h @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the Qt Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef DECLARATIVECATEGORYAXIS_H +#define DECLARATIVECATEGORYAXIS_H + +#include +#include + +#include +#include + +QT_CHARTS_BEGIN_NAMESPACE + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativeCategoryRange : public QObject +{ + Q_OBJECT + Q_PROPERTY(qreal endValue READ endValue WRITE setEndValue) + Q_PROPERTY(QString label READ label WRITE setLabel) + +public: + explicit DeclarativeCategoryRange(QObject *parent = 0); + qreal endValue() { return m_endValue; } + void setEndValue(qreal endValue) { m_endValue = endValue; } + QString label() { return m_label; } + void setLabel(QString label) { m_label = label; } + +private: + qreal m_endValue; + QString m_label; +}; + +class DeclarativeCategoryAxis : public QCategoryAxis, public QQmlParserStatus +{ + Q_OBJECT + Q_INTERFACES(QQmlParserStatus) + Q_PROPERTY(QQmlListProperty axisChildren READ axisChildren) + Q_CLASSINFO("DefaultProperty", "axisChildren") + Q_PROPERTY(AxisLabelsPosition labelsPosition READ labelsPosition WRITE setLabelsPosition NOTIFY labelsPositionChanged REVISION 1) + Q_ENUMS(AxisLabelsPosition) + +public: + // duplicating enums from QChart to make the QML api namings 1-to-1 with the C++ api + enum AxisLabelsPosition { + AxisLabelsPositionCenter = 0x0, + AxisLabelsPositionOnValue = 0x1 + }; + + explicit DeclarativeCategoryAxis(QObject *parent = 0); + QQmlListProperty axisChildren(); + + +public: // from QDeclarativeParserStatus + void classBegin(); + void componentComplete(); + +public: + AxisLabelsPosition labelsPosition() const; + void setLabelsPosition(AxisLabelsPosition position); + +Q_SIGNALS: + Q_REVISION(1) void labelsPositionChanged(AxisLabelsPosition position); + +public Q_SLOTS: + Q_INVOKABLE void append(const QString &label, qreal categoryEndValue); + Q_INVOKABLE void remove(const QString &label); + Q_INVOKABLE void replace(const QString &oldLabel, const QString &newLabel); + static void appendAxisChildren(QQmlListProperty *list, QObject *element); + +private: + static bool endValueLessThan(const QPair &value1, const QPair &value2); + +private: + AxisLabelsPosition m_labelsPosition; +}; + +QT_CHARTS_END_NAMESPACE + +#endif // DECLARATIVECATEGORYAXIS_H diff --git a/src/chartsqml2/declarativechart.cpp b/src/chartsqml2/declarativechart.cpp index 672a6b07..4782f3a4 100644 --- a/src/chartsqml2/declarativechart.cpp +++ b/src/chartsqml2/declarativechart.cpp @@ -27,26 +27,26 @@ ** ****************************************************************************/ -#include "declarativechart.h" +#include "declarativechart_p.h" #include -#include "declarativelineseries.h" -#include "declarativeareaseries.h" -#include "declarativebarseries.h" -#include "declarativepieseries.h" -#include "declarativesplineseries.h" -#include "declarativeboxplotseries.h" -#include "declarativecandlestickseries.h" -#include "declarativescatterseries.h" -#include "declarativechartnode.h" -#include "declarativeabstractrendernode.h" +#include "declarativelineseries_p.h" +#include "declarativeareaseries_p.h" +#include "declarativebarseries_p.h" +#include "declarativepieseries_p.h" +#include "declarativesplineseries_p.h" +#include "declarativeboxplotseries_p.h" +#include "declarativecandlestickseries_p.h" +#include "declarativescatterseries_p.h" +#include "declarativechartnode_p.h" +#include "declarativeabstractrendernode_p.h" #include #include #include #include #include -#include "declarativemargins.h" +#include "declarativemargins_p.h" #include -#include "declarativeaxes.h" +#include "declarativeaxes_p.h" #include #include #include @@ -488,7 +488,7 @@ void DeclarativeChart::initChart(QChart::ChartType type) this, SLOT(changeMargins(int,int,int,int))); connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), this, SLOT(handleSeriesAdded(QAbstractSeries*))); connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), this, SIGNAL(seriesRemoved(QAbstractSeries*))); - connect(m_chart, &QChart::plotAreaChanged, this, &DeclarativeChart::plotAreaChanged); + connect(m_chart, SIGNAL(plotAreaChanged(QRectF)), this, SIGNAL(plotAreaChanged(QRectF))); } void DeclarativeChart::handleSeriesAdded(QAbstractSeries *series) @@ -1469,6 +1469,6 @@ QPointF DeclarativeChart::mapToPosition(const QPointF &value, QAbstractSeries *s return m_chart->mapToPosition(value, series); } -#include "moc_declarativechart.cpp" +#include "moc_declarativechart_p.cpp" QT_CHARTS_END_NAMESPACE diff --git a/src/chartsqml2/declarativechart.h b/src/chartsqml2/declarativechart.h deleted file mode 100644 index 602e3b2c..00000000 --- a/src/chartsqml2/declarativechart.h +++ /dev/null @@ -1,264 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Charts module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVECHART_H -#define DECLARATIVECHART_H - -#include -#include "declarativeabstractrendernode.h" - -#include -#include -#include - -#include -#include -#include - -QT_CHARTS_BEGIN_NAMESPACE - -class DeclarativeMargins; -class Domain; -class DeclarativeAxes; - -class DeclarativeChart : public QQuickItem -{ - Q_OBJECT - Q_PROPERTY(Theme theme READ theme WRITE setTheme) - Q_PROPERTY(Animation animationOptions READ animationOptions WRITE setAnimationOptions) - Q_PROPERTY(int animationDuration READ animationDuration WRITE setAnimationDuration NOTIFY animationDurationChanged REVISION 5) - Q_PROPERTY(QEasingCurve animationEasingCurve READ animationEasingCurve WRITE setAnimationEasingCurve NOTIFY animationEasingCurveChanged REVISION 5) - Q_PROPERTY(QString title READ title WRITE setTitle) - Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont) - Q_PROPERTY(QColor titleColor READ titleColor WRITE setTitleColor NOTIFY titleColorChanged) - Q_PROPERTY(QLegend *legend READ legend CONSTANT) - Q_PROPERTY(int count READ count) - Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged) - Q_PROPERTY(bool dropShadowEnabled READ dropShadowEnabled WRITE setDropShadowEnabled NOTIFY dropShadowEnabledChanged) - Q_PROPERTY(qreal backgroundRoundness READ backgroundRoundness WRITE setBackgroundRoundness NOTIFY backgroundRoundnessChanged REVISION 3) - Q_PROPERTY(DeclarativeMargins *margins READ margins NOTIFY marginsChanged REVISION 2) - Q_PROPERTY(QRectF plotArea READ plotArea NOTIFY plotAreaChanged REVISION 1) - Q_PROPERTY(QColor plotAreaColor READ plotAreaColor WRITE setPlotAreaColor NOTIFY plotAreaColorChanged REVISION 3) - Q_PROPERTY(QQmlListProperty axes READ axes REVISION 2) - Q_PROPERTY(bool localizeNumbers READ localizeNumbers WRITE setLocalizeNumbers NOTIFY localizeNumbersChanged REVISION 4) - Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged REVISION 4) - Q_ENUMS(Animation) - Q_ENUMS(Theme) - Q_ENUMS(SeriesType) - -public: - // duplicating enums from QChart to make the QML api namings 1-to-1 with the C++ api - enum Theme { - ChartThemeLight = 0, - ChartThemeBlueCerulean, - ChartThemeDark, - ChartThemeBrownSand, - ChartThemeBlueNcs, - ChartThemeHighContrast, - ChartThemeBlueIcy, - ChartThemeQt - }; - - enum Animation { - NoAnimation = 0x0, - GridAxisAnimations = 0x1, - SeriesAnimations = 0x2, - AllAnimations = 0x3 - }; - - enum SeriesType { - SeriesTypeLine, - SeriesTypeArea, - SeriesTypeBar, - SeriesTypeStackedBar, - SeriesTypePercentBar, - SeriesTypePie, - SeriesTypeScatter, - SeriesTypeSpline, - SeriesTypeHorizontalBar, - SeriesTypeHorizontalStackedBar, - SeriesTypeHorizontalPercentBar, - SeriesTypeBoxPlot, - SeriesTypeCandlestick - }; - -public: - DeclarativeChart(QQuickItem *parent = 0); - ~DeclarativeChart(); - -public: // From parent classes - void childEvent(QChildEvent *event); - void componentComplete(); - void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); - QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *); -protected: - void mousePressEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void hoverMoveEvent(QHoverEvent *event); - void mouseDoubleClickEvent(QMouseEvent *event); -private Q_SLOTS: - void handleAntialiasingChanged(bool enable); - void sceneChanged(QList region); - void renderScene(); - -public: - void setTheme(DeclarativeChart::Theme theme); - DeclarativeChart::Theme theme(); - void setAnimationOptions(DeclarativeChart::Animation animations); - DeclarativeChart::Animation animationOptions(); - void setAnimationDuration(int msecs); - int animationDuration() const; - void setAnimationEasingCurve(const QEasingCurve &curve); - QEasingCurve animationEasingCurve() const; - void setTitle(QString title); - QString title(); - QLegend *legend(); - QFont titleFont() const; - void setTitleFont(const QFont &font); - void setTitleColor(QColor color); - QColor titleColor(); - void setBackgroundColor(QColor color); - QColor backgroundColor(); - void setPlotAreaColor(QColor color); - QColor plotAreaColor(); - void setLocalizeNumbers(bool localize); - bool localizeNumbers() const; - void setLocale(const QLocale &locale); - QLocale locale() const; - - int count(); - void setDropShadowEnabled(bool enabled); - bool dropShadowEnabled(); - qreal backgroundRoundness() const; - void setBackgroundRoundness(qreal diameter); - - // Margins & plotArea - DeclarativeMargins *margins() { return m_margins; } - QRectF plotArea() { return m_chart->plotArea(); } - - // Axis handling - QAbstractAxis *defaultAxis(Qt::Orientation orientation, QAbstractSeries *series); - void initializeAxes(QAbstractSeries *series); - void doInitializeAxes(QAbstractSeries *series, DeclarativeAxes *axes); - QQmlListProperty axes(); - static void axesAppendFunc(QQmlListProperty *list, QAbstractAxis *element); - static int axesCountFunc(QQmlListProperty *list); - static QAbstractAxis *axesAtFunc(QQmlListProperty *list, int index); - static void axesClearFunc(QQmlListProperty *list); - -public: - Q_INVOKABLE QAbstractSeries *series(int index); - Q_INVOKABLE QAbstractSeries *series(QString seriesName); - Q_INVOKABLE QAbstractSeries *createSeries(int type, QString name = "", QAbstractAxis *axisX = 0, QAbstractAxis *axisY = 0); - Q_INVOKABLE void removeSeries(QAbstractSeries *series); - Q_INVOKABLE void removeAllSeries() { m_chart->removeAllSeries(); } - Q_INVOKABLE void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = 0); - Q_INVOKABLE void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = 0); - Q_INVOKABLE QAbstractAxis *axisX(QAbstractSeries *series = 0); - Q_INVOKABLE QAbstractAxis *axisY(QAbstractSeries *series = 0); - Q_INVOKABLE void zoom(qreal factor); - Q_REVISION(5) Q_INVOKABLE void zoomIn(); - Q_REVISION(5) Q_INVOKABLE void zoomIn(const QRectF &rectangle); - Q_REVISION(5) Q_INVOKABLE void zoomOut(); - Q_REVISION(5) Q_INVOKABLE void zoomReset(); - Q_REVISION(5) Q_INVOKABLE bool isZoomed(); - Q_INVOKABLE void scrollLeft(qreal pixels); - Q_INVOKABLE void scrollRight(qreal pixels); - Q_INVOKABLE void scrollUp(qreal pixels); - Q_INVOKABLE void scrollDown(qreal pixels); - Q_REVISION(5) Q_INVOKABLE QPointF mapToValue(const QPointF &position, - QAbstractSeries *series = 0); - Q_REVISION(5) Q_INVOKABLE QPointF mapToPosition(const QPointF &value, - QAbstractSeries *series = 0); - - -Q_SIGNALS: - void axisLabelsChanged(); - void titleColorChanged(QColor color); - void backgroundColorChanged(); - void dropShadowEnabledChanged(bool enabled); - Q_REVISION(2) void marginsChanged(); - void plotAreaChanged(QRectF plotArea); - void seriesAdded(QAbstractSeries *series); - void seriesRemoved(QAbstractSeries *series); - Q_REVISION(3) void plotAreaColorChanged(); - Q_REVISION(3) void backgroundRoundnessChanged(qreal diameter); - Q_REVISION(4) void localizeNumbersChanged(); - Q_REVISION(4) void localeChanged(); - Q_REVISION(5) void animationDurationChanged(int msecs); - Q_REVISION(5) void animationEasingCurveChanged(QEasingCurve curve); - void needRender(); - void pendingRenderNodeMouseEventResponses(); - -private Q_SLOTS: - void changeMargins(int top, int bottom, int left, int right); - void handleAxisXSet(QAbstractAxis *axis); - void handleAxisYSet(QAbstractAxis *axis); - void handleAxisXTopSet(QAbstractAxis *axis); - void handleAxisYRightSet(QAbstractAxis *axis); - void handleSeriesAdded(QAbstractSeries *series); - void handlePendingRenderNodeMouseEventResponses(); - -protected: - explicit DeclarativeChart(QChart::ChartType type, QQuickItem *parent); - -private: - void initChart(QChart::ChartType type); - void seriesAxisAttachHelper(QAbstractSeries *series, QAbstractAxis *axis, - Qt::Orientations orientation, Qt::Alignment alignment); - void findMinMaxForSeries(QAbstractSeries *series,Qt::Orientations orientation, - qreal &min, qreal &max); - void queueRendererMouseEvent(QMouseEvent *event); - - // Extending QChart with DeclarativeChart is not possible because QObject does not support - // multi inheritance, so we now have a QChart as a member instead - QChart *m_chart; - QGraphicsScene *m_scene; - QPointF m_mousePressScenePoint; - QPoint m_mousePressScreenPoint; - QPointF m_lastMouseMoveScenePoint; - QPoint m_lastMouseMoveScreenPoint; - Qt::MouseButton m_mousePressButton; - Qt::MouseButtons m_mousePressButtons; - QImage *m_sceneImage; - bool m_sceneImageDirty; - bool m_updatePending; - Qt::HANDLE m_paintThreadId; - Qt::HANDLE m_guiThreadId; - DeclarativeMargins *m_margins; - GLXYSeriesDataManager *m_glXYDataManager; - bool m_sceneImageNeedsClear; - QVector m_pendingRenderNodeMouseEvents; - QVector m_pendingRenderNodeMouseEventResponses; - QRectF m_adjustedPlotArea; -}; - -QT_CHARTS_END_NAMESPACE - -#endif // DECLARATIVECHART_H diff --git a/src/chartsqml2/declarativechart_p.h b/src/chartsqml2/declarativechart_p.h new file mode 100644 index 00000000..1d8e6d31 --- /dev/null +++ b/src/chartsqml2/declarativechart_p.h @@ -0,0 +1,274 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the Qt Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef DECLARATIVECHART_H +#define DECLARATIVECHART_H + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +QT_CHARTS_BEGIN_NAMESPACE + +class DeclarativeMargins; +class Domain; +class DeclarativeAxes; + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativeChart : public QQuickItem +{ + Q_OBJECT + Q_PROPERTY(Theme theme READ theme WRITE setTheme) + Q_PROPERTY(Animation animationOptions READ animationOptions WRITE setAnimationOptions) + Q_PROPERTY(int animationDuration READ animationDuration WRITE setAnimationDuration NOTIFY animationDurationChanged REVISION 5) + Q_PROPERTY(QEasingCurve animationEasingCurve READ animationEasingCurve WRITE setAnimationEasingCurve NOTIFY animationEasingCurveChanged REVISION 5) + Q_PROPERTY(QString title READ title WRITE setTitle) + Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont) + Q_PROPERTY(QColor titleColor READ titleColor WRITE setTitleColor NOTIFY titleColorChanged) + Q_PROPERTY(QLegend *legend READ legend CONSTANT) + Q_PROPERTY(int count READ count) + Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged) + Q_PROPERTY(bool dropShadowEnabled READ dropShadowEnabled WRITE setDropShadowEnabled NOTIFY dropShadowEnabledChanged) + Q_PROPERTY(qreal backgroundRoundness READ backgroundRoundness WRITE setBackgroundRoundness NOTIFY backgroundRoundnessChanged REVISION 3) + Q_PROPERTY(DeclarativeMargins *margins READ margins NOTIFY marginsChanged REVISION 2) + Q_PROPERTY(QRectF plotArea READ plotArea NOTIFY plotAreaChanged REVISION 1) + Q_PROPERTY(QColor plotAreaColor READ plotAreaColor WRITE setPlotAreaColor NOTIFY plotAreaColorChanged REVISION 3) + Q_PROPERTY(QQmlListProperty axes READ axes REVISION 2) + Q_PROPERTY(bool localizeNumbers READ localizeNumbers WRITE setLocalizeNumbers NOTIFY localizeNumbersChanged REVISION 4) + Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged REVISION 4) + Q_ENUMS(Animation) + Q_ENUMS(Theme) + Q_ENUMS(SeriesType) + +public: + // duplicating enums from QChart to make the QML api namings 1-to-1 with the C++ api + enum Theme { + ChartThemeLight = 0, + ChartThemeBlueCerulean, + ChartThemeDark, + ChartThemeBrownSand, + ChartThemeBlueNcs, + ChartThemeHighContrast, + ChartThemeBlueIcy, + ChartThemeQt + }; + + enum Animation { + NoAnimation = 0x0, + GridAxisAnimations = 0x1, + SeriesAnimations = 0x2, + AllAnimations = 0x3 + }; + + enum SeriesType { + SeriesTypeLine, + SeriesTypeArea, + SeriesTypeBar, + SeriesTypeStackedBar, + SeriesTypePercentBar, + SeriesTypePie, + SeriesTypeScatter, + SeriesTypeSpline, + SeriesTypeHorizontalBar, + SeriesTypeHorizontalStackedBar, + SeriesTypeHorizontalPercentBar, + SeriesTypeBoxPlot, + SeriesTypeCandlestick + }; + +public: + DeclarativeChart(QQuickItem *parent = 0); + ~DeclarativeChart(); + +public: // From parent classes + void childEvent(QChildEvent *event); + void componentComplete(); + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); + QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *); +protected: + void mousePressEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + void hoverMoveEvent(QHoverEvent *event); + void mouseDoubleClickEvent(QMouseEvent *event); +private Q_SLOTS: + void handleAntialiasingChanged(bool enable); + void sceneChanged(QList region); + void renderScene(); + +public: + void setTheme(DeclarativeChart::Theme theme); + DeclarativeChart::Theme theme(); + void setAnimationOptions(DeclarativeChart::Animation animations); + DeclarativeChart::Animation animationOptions(); + void setAnimationDuration(int msecs); + int animationDuration() const; + void setAnimationEasingCurve(const QEasingCurve &curve); + QEasingCurve animationEasingCurve() const; + void setTitle(QString title); + QString title(); + QLegend *legend(); + QFont titleFont() const; + void setTitleFont(const QFont &font); + void setTitleColor(QColor color); + QColor titleColor(); + void setBackgroundColor(QColor color); + QColor backgroundColor(); + void setPlotAreaColor(QColor color); + QColor plotAreaColor(); + void setLocalizeNumbers(bool localize); + bool localizeNumbers() const; + void setLocale(const QLocale &locale); + QLocale locale() const; + + int count(); + void setDropShadowEnabled(bool enabled); + bool dropShadowEnabled(); + qreal backgroundRoundness() const; + void setBackgroundRoundness(qreal diameter); + + // Margins & plotArea + DeclarativeMargins *margins() { return m_margins; } + QRectF plotArea() { return m_chart->plotArea(); } + + // Axis handling + QAbstractAxis *defaultAxis(Qt::Orientation orientation, QAbstractSeries *series); + void initializeAxes(QAbstractSeries *series); + void doInitializeAxes(QAbstractSeries *series, DeclarativeAxes *axes); + QQmlListProperty axes(); + static void axesAppendFunc(QQmlListProperty *list, QAbstractAxis *element); + static int axesCountFunc(QQmlListProperty *list); + static QAbstractAxis *axesAtFunc(QQmlListProperty *list, int index); + static void axesClearFunc(QQmlListProperty *list); + +public: + Q_INVOKABLE QAbstractSeries *series(int index); + Q_INVOKABLE QAbstractSeries *series(QString seriesName); + Q_INVOKABLE QAbstractSeries *createSeries(int type, QString name = "", QAbstractAxis *axisX = 0, QAbstractAxis *axisY = 0); + Q_INVOKABLE void removeSeries(QAbstractSeries *series); + Q_INVOKABLE void removeAllSeries() { m_chart->removeAllSeries(); } + Q_INVOKABLE void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = 0); + Q_INVOKABLE void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = 0); + Q_INVOKABLE QAbstractAxis *axisX(QAbstractSeries *series = 0); + Q_INVOKABLE QAbstractAxis *axisY(QAbstractSeries *series = 0); + Q_INVOKABLE void zoom(qreal factor); + Q_REVISION(5) Q_INVOKABLE void zoomIn(); + Q_REVISION(5) Q_INVOKABLE void zoomIn(const QRectF &rectangle); + Q_REVISION(5) Q_INVOKABLE void zoomOut(); + Q_REVISION(5) Q_INVOKABLE void zoomReset(); + Q_REVISION(5) Q_INVOKABLE bool isZoomed(); + Q_INVOKABLE void scrollLeft(qreal pixels); + Q_INVOKABLE void scrollRight(qreal pixels); + Q_INVOKABLE void scrollUp(qreal pixels); + Q_INVOKABLE void scrollDown(qreal pixels); + Q_REVISION(5) Q_INVOKABLE QPointF mapToValue(const QPointF &position, + QAbstractSeries *series = 0); + Q_REVISION(5) Q_INVOKABLE QPointF mapToPosition(const QPointF &value, + QAbstractSeries *series = 0); + + +Q_SIGNALS: + void axisLabelsChanged(); + void titleColorChanged(QColor color); + void backgroundColorChanged(); + void dropShadowEnabledChanged(bool enabled); + Q_REVISION(2) void marginsChanged(); + void plotAreaChanged(QRectF plotArea); + void seriesAdded(QAbstractSeries *series); + void seriesRemoved(QAbstractSeries *series); + Q_REVISION(3) void plotAreaColorChanged(); + Q_REVISION(3) void backgroundRoundnessChanged(qreal diameter); + Q_REVISION(4) void localizeNumbersChanged(); + Q_REVISION(4) void localeChanged(); + Q_REVISION(5) void animationDurationChanged(int msecs); + Q_REVISION(5) void animationEasingCurveChanged(QEasingCurve curve); + void needRender(); + void pendingRenderNodeMouseEventResponses(); + +private Q_SLOTS: + void changeMargins(int top, int bottom, int left, int right); + void handleAxisXSet(QAbstractAxis *axis); + void handleAxisYSet(QAbstractAxis *axis); + void handleAxisXTopSet(QAbstractAxis *axis); + void handleAxisYRightSet(QAbstractAxis *axis); + void handleSeriesAdded(QAbstractSeries *series); + void handlePendingRenderNodeMouseEventResponses(); + +protected: + explicit DeclarativeChart(QChart::ChartType type, QQuickItem *parent); + +private: + void initChart(QChart::ChartType type); + void seriesAxisAttachHelper(QAbstractSeries *series, QAbstractAxis *axis, + Qt::Orientations orientation, Qt::Alignment alignment); + void findMinMaxForSeries(QAbstractSeries *series,Qt::Orientations orientation, + qreal &min, qreal &max); + void queueRendererMouseEvent(QMouseEvent *event); + + // Extending QChart with DeclarativeChart is not possible because QObject does not support + // multi inheritance, so we now have a QChart as a member instead + QChart *m_chart; + QGraphicsScene *m_scene; + QPointF m_mousePressScenePoint; + QPoint m_mousePressScreenPoint; + QPointF m_lastMouseMoveScenePoint; + QPoint m_lastMouseMoveScreenPoint; + Qt::MouseButton m_mousePressButton; + Qt::MouseButtons m_mousePressButtons; + QImage *m_sceneImage; + bool m_sceneImageDirty; + bool m_updatePending; + Qt::HANDLE m_paintThreadId; + Qt::HANDLE m_guiThreadId; + DeclarativeMargins *m_margins; + GLXYSeriesDataManager *m_glXYDataManager; + bool m_sceneImageNeedsClear; + QVector m_pendingRenderNodeMouseEvents; + QVector m_pendingRenderNodeMouseEventResponses; + QRectF m_adjustedPlotArea; +}; + +QT_CHARTS_END_NAMESPACE + +#endif // DECLARATIVECHART_H diff --git a/src/chartsqml2/declarativechartglobal_p.h b/src/chartsqml2/declarativechartglobal_p.h new file mode 100644 index 00000000..a897d4ca --- /dev/null +++ b/src/chartsqml2/declarativechartglobal_p.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the Qt Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef DECLARATIVECHARTGLOBAL_H +#define DECLARATIVECHARTGLOBAL_H + +#include + +#ifndef QT_STATIC +# if defined(QT_BUILD_QMLCHARTS_LIB) +# define QT_QMLCHARTS_PRIVATE_EXPORT Q_DECL_EXPORT +# else +# define QT_QMLCHARTS_PRIVATE_EXPORT Q_DECL_IMPORT +# endif +#else +# define QT_QMLCHARTS_PRIVATE_EXPORT +#endif + +#endif // DECLARATIVECHARTGLOBAL_H diff --git a/src/chartsqml2/declarativechartnode.cpp b/src/chartsqml2/declarativechartnode.cpp index 0b8f5a5a..76fddbc5 100644 --- a/src/chartsqml2/declarativechartnode.cpp +++ b/src/chartsqml2/declarativechartnode.cpp @@ -27,15 +27,15 @@ ** ****************************************************************************/ -#include "declarativechartnode.h" -#include "declarativeabstractrendernode.h" +#include "declarativechartnode_p.h" +#include "declarativeabstractrendernode_p.h" #include #include #include #ifndef QT_NO_OPENGL -# include "declarativeopenglrendernode.h" +# include "declarativeopenglrendernode_p.h" #endif QT_CHARTS_BEGIN_NAMESPACE diff --git a/src/chartsqml2/declarativechartnode.h b/src/chartsqml2/declarativechartnode.h deleted file mode 100644 index c93307fc..00000000 --- a/src/chartsqml2/declarativechartnode.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Charts module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVECHARTNODE_P_H -#define DECLARATIVECHARTNODE_P_H - -#include -#include -#include -#include - -QT_CHARTS_BEGIN_NAMESPACE - -class DeclarativeAbstractRenderNode; -class DeclarativeChartNode : public QSGRootNode -{ -public: - DeclarativeChartNode(QQuickWindow *window); - ~DeclarativeChartNode(); - - void createTextureFromImage(const QImage &chartImage); - DeclarativeAbstractRenderNode *renderNode() const { return m_renderNode; } - - void setRect(const QRectF &rect); - -private: - QRectF m_rect; - QQuickWindow *m_window; - DeclarativeAbstractRenderNode *m_renderNode; - QSGImageNode *m_imageNode; -}; - -QT_CHARTS_END_NAMESPACE - -#endif // DECLARATIVECHARTNODE_P_H diff --git a/src/chartsqml2/declarativechartnode_p.h b/src/chartsqml2/declarativechartnode_p.h new file mode 100644 index 00000000..cd7b9ee5 --- /dev/null +++ b/src/chartsqml2/declarativechartnode_p.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the Qt Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef DECLARATIVECHARTNODE_P_H +#define DECLARATIVECHARTNODE_P_H + +#include +#include +#include +#include + +QT_CHARTS_BEGIN_NAMESPACE + +class DeclarativeAbstractRenderNode; +class DeclarativeChartNode : public QSGRootNode +{ +public: + DeclarativeChartNode(QQuickWindow *window); + ~DeclarativeChartNode(); + + void createTextureFromImage(const QImage &chartImage); + DeclarativeAbstractRenderNode *renderNode() const { return m_renderNode; } + + void setRect(const QRectF &rect); + +private: + QRectF m_rect; + QQuickWindow *m_window; + DeclarativeAbstractRenderNode *m_renderNode; + QSGImageNode *m_imageNode; +}; + +QT_CHARTS_END_NAMESPACE + +#endif // DECLARATIVECHARTNODE_P_H diff --git a/src/chartsqml2/declarativelineseries.cpp b/src/chartsqml2/declarativelineseries.cpp index 49ee3210..73febddd 100644 --- a/src/chartsqml2/declarativelineseries.cpp +++ b/src/chartsqml2/declarativelineseries.cpp @@ -27,7 +27,7 @@ ** ****************************************************************************/ -#include "declarativelineseries.h" +#include "declarativelineseries_p.h" QT_CHARTS_BEGIN_NAMESPACE @@ -109,6 +109,6 @@ void DeclarativeLineSeries::appendDeclarativeChildren(QQmlListProperty // Empty implementation, children are parsed in componentComplete } -#include "moc_declarativelineseries.cpp" +#include "moc_declarativelineseries_p.cpp" QT_CHARTS_END_NAMESPACE diff --git a/src/chartsqml2/declarativelineseries.h b/src/chartsqml2/declarativelineseries.h deleted file mode 100644 index 39c63150..00000000 --- a/src/chartsqml2/declarativelineseries.h +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Charts module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVELINESERIES_H -#define DECLARATIVELINESERIES_H - -#include -#include "declarativexyseries.h" -#include "declarativeaxes.h" - -#include -#include - -QT_CHARTS_BEGIN_NAMESPACE - -class DeclarativeLineSeries : public QLineSeries, public DeclarativeXySeries, public QQmlParserStatus -{ - Q_OBJECT - Q_INTERFACES(QQmlParserStatus) - Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) - Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) - Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2) - Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2) - Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3) - Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3) - Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged REVISION 1) - Q_PROPERTY(Qt::PenStyle style READ style WRITE setStyle NOTIFY styleChanged REVISION 1) - Q_PROPERTY(Qt::PenCapStyle capStyle READ capStyle WRITE setCapStyle NOTIFY capStyleChanged REVISION 1) - Q_PROPERTY(QQmlListProperty declarativeChildren READ declarativeChildren) - Q_CLASSINFO("DefaultProperty", "declarativeChildren") - -public: - explicit DeclarativeLineSeries(QObject *parent = 0); - QXYSeries *xySeries() { return this; } - QAbstractAxis *axisX() { return m_axes->axisX(); } - void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } - QAbstractAxis *axisY() { return m_axes->axisY(); } - void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } - QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - QAbstractAxis *axisAngular() { return m_axes->axisX(); } - void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); } - QAbstractAxis *axisRadial() { return m_axes->axisY(); } - void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); } - qreal width() const; - void setWidth(qreal width); - Qt::PenStyle style() const; - void setStyle(Qt::PenStyle style); - Qt::PenCapStyle capStyle() const; - void setCapStyle(Qt::PenCapStyle capStyle); - QQmlListProperty declarativeChildren(); - -public: // from QDeclarativeParserStatus - void classBegin() { DeclarativeXySeries::classBegin(); } - void componentComplete() { DeclarativeXySeries::componentComplete(); } - -public: - Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); } - Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); } - Q_REVISION(3) Q_INVOKABLE void replace(int index, qreal newX, qreal newY) { DeclarativeXySeries::replace(index, newX, newY); } - Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); } - Q_REVISION(3) Q_INVOKABLE void remove(int index) { DeclarativeXySeries::remove(index); } - Q_REVISION(4) Q_INVOKABLE void removePoints(int index, int count) { DeclarativeXySeries::removePoints(index, count); } - Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); } - Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); } - Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); } - -Q_SIGNALS: - void countChanged(int count); - Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); - Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); - Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis); - Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis); - Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis); - Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis); - Q_REVISION(1) void widthChanged(qreal width); - Q_REVISION(1) void styleChanged(Qt::PenStyle style); - Q_REVISION(1) void capStyleChanged(Qt::PenCapStyle capStyle); - -public Q_SLOTS: - static void appendDeclarativeChildren(QQmlListProperty *list, QObject *element); - void handleCountChanged(int index); - -public: - DeclarativeAxes *m_axes; -}; - -QT_CHARTS_END_NAMESPACE - -#endif // DECLARATIVELINESERIES_H diff --git a/src/chartsqml2/declarativelineseries_p.h b/src/chartsqml2/declarativelineseries_p.h new file mode 100644 index 00000000..e3fcc14a --- /dev/null +++ b/src/chartsqml2/declarativelineseries_p.h @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the Qt Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef DECLARATIVELINESERIES_H +#define DECLARATIVELINESERIES_H + +#include +#include +#include +#include + +#include +#include + +QT_CHARTS_BEGIN_NAMESPACE + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativeLineSeries : public QLineSeries, public DeclarativeXySeries, public QQmlParserStatus +{ + Q_OBJECT + Q_INTERFACES(QQmlParserStatus) + Q_PROPERTY(int count READ count NOTIFY countChanged) + Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) + Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) + Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2) + Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2) + Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3) + Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3) + Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged REVISION 1) + Q_PROPERTY(Qt::PenStyle style READ style WRITE setStyle NOTIFY styleChanged REVISION 1) + Q_PROPERTY(Qt::PenCapStyle capStyle READ capStyle WRITE setCapStyle NOTIFY capStyleChanged REVISION 1) + Q_PROPERTY(QQmlListProperty declarativeChildren READ declarativeChildren) + Q_CLASSINFO("DefaultProperty", "declarativeChildren") + +public: + explicit DeclarativeLineSeries(QObject *parent = 0); + QXYSeries *xySeries() { return this; } + QAbstractAxis *axisX() { return m_axes->axisX(); } + void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } + QAbstractAxis *axisY() { return m_axes->axisY(); } + void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } + QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } + void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } + QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } + void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } + QAbstractAxis *axisAngular() { return m_axes->axisX(); } + void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); } + QAbstractAxis *axisRadial() { return m_axes->axisY(); } + void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); } + qreal width() const; + void setWidth(qreal width); + Qt::PenStyle style() const; + void setStyle(Qt::PenStyle style); + Qt::PenCapStyle capStyle() const; + void setCapStyle(Qt::PenCapStyle capStyle); + QQmlListProperty declarativeChildren(); + +public: // from QDeclarativeParserStatus + void classBegin() { DeclarativeXySeries::classBegin(); } + void componentComplete() { DeclarativeXySeries::componentComplete(); } + +public: + Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); } + Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); } + Q_REVISION(3) Q_INVOKABLE void replace(int index, qreal newX, qreal newY) { DeclarativeXySeries::replace(index, newX, newY); } + Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); } + Q_REVISION(3) Q_INVOKABLE void remove(int index) { DeclarativeXySeries::remove(index); } + Q_REVISION(4) Q_INVOKABLE void removePoints(int index, int count) { DeclarativeXySeries::removePoints(index, count); } + Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); } + Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); } + Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); } + +Q_SIGNALS: + void countChanged(int count); + Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); + Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); + Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis); + Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis); + Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis); + Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis); + Q_REVISION(1) void widthChanged(qreal width); + Q_REVISION(1) void styleChanged(Qt::PenStyle style); + Q_REVISION(1) void capStyleChanged(Qt::PenCapStyle capStyle); + +public Q_SLOTS: + static void appendDeclarativeChildren(QQmlListProperty *list, QObject *element); + void handleCountChanged(int index); + +public: + DeclarativeAxes *m_axes; +}; + +QT_CHARTS_END_NAMESPACE + +#endif // DECLARATIVELINESERIES_H diff --git a/src/chartsqml2/declarativemargins.cpp b/src/chartsqml2/declarativemargins.cpp index a4284dbc..66891e2a 100644 --- a/src/chartsqml2/declarativemargins.cpp +++ b/src/chartsqml2/declarativemargins.cpp @@ -27,7 +27,7 @@ ** ****************************************************************************/ -#include "declarativemargins.h" +#include "declarativemargins_p.h" #include #include @@ -123,6 +123,6 @@ void DeclarativeMargins::setRight(int right) } } -#include "moc_declarativemargins.cpp" +#include "moc_declarativemargins_p.cpp" QT_CHARTS_END_NAMESPACE diff --git a/src/chartsqml2/declarativemargins.h b/src/chartsqml2/declarativemargins.h deleted file mode 100644 index bbc6b0cb..00000000 --- a/src/chartsqml2/declarativemargins.h +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Charts module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVE_MARGINS_H -#define DECLARATIVE_MARGINS_H - -#include -#include -#include - -QT_CHARTS_BEGIN_NAMESPACE - -class DeclarativeMargins : public QObject, public QMargins -{ - Q_OBJECT - Q_PROPERTY(int top READ top WRITE setTop NOTIFY topChanged) - Q_PROPERTY(int bottom READ bottom WRITE setBottom NOTIFY bottomChanged) - Q_PROPERTY(int left READ left WRITE setLeft NOTIFY leftChanged) - Q_PROPERTY(int right READ right WRITE setRight NOTIFY rightChanged) - -public: - explicit DeclarativeMargins(QObject *parent = 0); - void setTop(int top); - void setBottom(int bottom); - void setLeft(int left); - void setRight(int right); - -Q_SIGNALS: - void topChanged(int top, int bottom, int left, int right); - void bottomChanged(int top, int bottom, int left, int right); - void leftChanged(int top, int bottom, int left, int right); - void rightChanged(int top, int bottom, int left, int right); -}; - -QT_CHARTS_END_NAMESPACE - -#endif // DECLARATIVE_MARGINS_H diff --git a/src/chartsqml2/declarativemargins_p.h b/src/chartsqml2/declarativemargins_p.h new file mode 100644 index 00000000..b9c7ab0a --- /dev/null +++ b/src/chartsqml2/declarativemargins_p.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the Qt Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef DECLARATIVE_MARGINS_H +#define DECLARATIVE_MARGINS_H + +#include +#include +#include +#include + +QT_CHARTS_BEGIN_NAMESPACE + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativeMargins : public QObject, public QMargins +{ + Q_OBJECT + Q_PROPERTY(int top READ top WRITE setTop NOTIFY topChanged) + Q_PROPERTY(int bottom READ bottom WRITE setBottom NOTIFY bottomChanged) + Q_PROPERTY(int left READ left WRITE setLeft NOTIFY leftChanged) + Q_PROPERTY(int right READ right WRITE setRight NOTIFY rightChanged) + +public: + explicit DeclarativeMargins(QObject *parent = 0); + void setTop(int top); + void setBottom(int bottom); + void setLeft(int left); + void setRight(int right); + +Q_SIGNALS: + void topChanged(int top, int bottom, int left, int right); + void bottomChanged(int top, int bottom, int left, int right); + void leftChanged(int top, int bottom, int left, int right); + void rightChanged(int top, int bottom, int left, int right); +}; + +QT_CHARTS_END_NAMESPACE + +#endif // DECLARATIVE_MARGINS_H diff --git a/src/chartsqml2/declarativeopenglrendernode.cpp b/src/chartsqml2/declarativeopenglrendernode.cpp index 742a9301..685c331b 100644 --- a/src/chartsqml2/declarativeopenglrendernode.cpp +++ b/src/chartsqml2/declarativeopenglrendernode.cpp @@ -27,7 +27,7 @@ ** ****************************************************************************/ -#include "declarativeopenglrendernode.h" +#include "declarativeopenglrendernode_p.h" #include #include diff --git a/src/chartsqml2/declarativeopenglrendernode.h b/src/chartsqml2/declarativeopenglrendernode.h deleted file mode 100644 index a07ed324..00000000 --- a/src/chartsqml2/declarativeopenglrendernode.h +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Charts module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVEOPENGLRENDERNODE_P_H -#define DECLARATIVEOPENGLRENDERNODE_P_H - -#include "declarativeabstractrendernode.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_CHARTS_BEGIN_NAMESPACE - -class DeclarativeOpenGLRenderNode : public QObject, public DeclarativeAbstractRenderNode, QOpenGLFunctions -{ - Q_OBJECT -public: - DeclarativeOpenGLRenderNode(QQuickWindow *window); - ~DeclarativeOpenGLRenderNode(); - - void initGL(); - QSize textureSize() const override { return m_textureSize; } - void setTextureSize(const QSize &size) override; - - void setSeriesData(bool mapDirty, const GLXYDataMap &dataMap) override; - void setRect(const QRectF &rect) override; - void setAntialiasing(bool enable) override; - void addMouseEvents(const QVector &events) override; - void takeMouseEventResponses(QVector &responses) override; - -public Q_SLOTS: - void render(); - -private: - void renderGL(bool selection); - void renderSelection(); - void renderVisual(); - void recreateFBO(); - void cleanXYSeriesResources(const QXYSeries *series); - void handleMouseEvents(); - const QXYSeries *findSeriesAtEvent(QMouseEvent *event); - - QSGTexture *m_texture; - QSGImageNode *m_imageNode; - QQuickWindow *m_window; - QQuickWindow::CreateTextureOptions m_textureOptions; - QSize m_textureSize; - bool m_recreateFbo; - GLXYDataMap m_xyDataMap; - QOpenGLFramebufferObject *m_fbo; - QOpenGLFramebufferObject *m_resolvedFbo; - QOpenGLFramebufferObject *m_selectionFbo; - QOpenGLShaderProgram *m_program; - int m_shaderAttribLoc; - int m_colorUniformLoc; - int m_minUniformLoc; - int m_deltaUniformLoc; - int m_pointSizeUniformLoc; - int m_matrixUniformLoc; - QOpenGLVertexArrayObject m_vao; - QHash m_seriesBufferMap; - bool m_renderNeeded; - QRectF m_rect; - bool m_antialiasing; - QVector m_mouseEvents; - QVector m_mouseEventResponses; - bool m_selectionRenderNeeded; - QVector m_selectionVector; - QPoint m_mousePressPos; - bool m_mousePressed; - const QXYSeries *m_lastPressSeries; - const QXYSeries *m_lastHoverSeries; -}; - -QT_CHARTS_END_NAMESPACE - -#endif // DECLARATIVEOPENGLRENDERNODE_P_H diff --git a/src/chartsqml2/declarativeopenglrendernode_p.h b/src/chartsqml2/declarativeopenglrendernode_p.h new file mode 100644 index 00000000..d4bb2372 --- /dev/null +++ b/src/chartsqml2/declarativeopenglrendernode_p.h @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the Qt Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef DECLARATIVEOPENGLRENDERNODE_P_H +#define DECLARATIVEOPENGLRENDERNODE_P_H + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_CHARTS_BEGIN_NAMESPACE + +class DeclarativeOpenGLRenderNode : public QObject, public DeclarativeAbstractRenderNode, QOpenGLFunctions +{ + Q_OBJECT +public: + DeclarativeOpenGLRenderNode(QQuickWindow *window); + ~DeclarativeOpenGLRenderNode(); + + void initGL(); + QSize textureSize() const override { return m_textureSize; } + void setTextureSize(const QSize &size) override; + + void setSeriesData(bool mapDirty, const GLXYDataMap &dataMap) override; + void setRect(const QRectF &rect) override; + void setAntialiasing(bool enable) override; + void addMouseEvents(const QVector &events) override; + void takeMouseEventResponses(QVector &responses) override; + +public Q_SLOTS: + void render(); + +private: + void renderGL(bool selection); + void renderSelection(); + void renderVisual(); + void recreateFBO(); + void cleanXYSeriesResources(const QXYSeries *series); + void handleMouseEvents(); + const QXYSeries *findSeriesAtEvent(QMouseEvent *event); + + QSGTexture *m_texture; + QSGImageNode *m_imageNode; + QQuickWindow *m_window; + QQuickWindow::CreateTextureOptions m_textureOptions; + QSize m_textureSize; + bool m_recreateFbo; + GLXYDataMap m_xyDataMap; + QOpenGLFramebufferObject *m_fbo; + QOpenGLFramebufferObject *m_resolvedFbo; + QOpenGLFramebufferObject *m_selectionFbo; + QOpenGLShaderProgram *m_program; + int m_shaderAttribLoc; + int m_colorUniformLoc; + int m_minUniformLoc; + int m_deltaUniformLoc; + int m_pointSizeUniformLoc; + int m_matrixUniformLoc; + QOpenGLVertexArrayObject m_vao; + QHash m_seriesBufferMap; + bool m_renderNeeded; + QRectF m_rect; + bool m_antialiasing; + QVector m_mouseEvents; + QVector m_mouseEventResponses; + bool m_selectionRenderNeeded; + QVector m_selectionVector; + QPoint m_mousePressPos; + bool m_mousePressed; + const QXYSeries *m_lastPressSeries; + const QXYSeries *m_lastHoverSeries; +}; + +QT_CHARTS_END_NAMESPACE + +#endif // DECLARATIVEOPENGLRENDERNODE_P_H diff --git a/src/chartsqml2/declarativepieseries.cpp b/src/chartsqml2/declarativepieseries.cpp index ade8e13e..300f5f37 100644 --- a/src/chartsqml2/declarativepieseries.cpp +++ b/src/chartsqml2/declarativepieseries.cpp @@ -27,7 +27,7 @@ ** ****************************************************************************/ -#include "declarativepieseries.h" +#include "declarativepieseries_p.h" #include #include #include @@ -158,6 +158,6 @@ void DeclarativePieSeries::handleRemoved(QList slices) emit sliceRemoved(slice); } -#include "moc_declarativepieseries.cpp" +#include "moc_declarativepieseries_p.cpp" QT_CHARTS_END_NAMESPACE diff --git a/src/chartsqml2/declarativepieseries.h b/src/chartsqml2/declarativepieseries.h deleted file mode 100644 index 807783c6..00000000 --- a/src/chartsqml2/declarativepieseries.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Charts module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVEPIESERIES_H -#define DECLARATIVEPIESERIES_H - -#include -#include - -#include -#include - -QT_CHARTS_BEGIN_NAMESPACE - -class DeclarativePieSlice : public QPieSlice -{ - Q_OBJECT - Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged) - -public: - explicit DeclarativePieSlice(QObject *parent = 0); - QString brushFilename() const; - void setBrushFilename(const QString &brushFilename); - -Q_SIGNALS: - void brushFilenameChanged(const QString &brushFilename); - -private Q_SLOTS: - void handleBrushChanged(); - -private: - QString m_brushFilename; - QImage m_brushImage; -}; - -class DeclarativePieSeries : public QPieSeries, public QQmlParserStatus -{ - Q_OBJECT - Q_INTERFACES(QQmlParserStatus) - Q_PROPERTY(QQmlListProperty seriesChildren READ seriesChildren) - Q_CLASSINFO("DefaultProperty", "seriesChildren") - -public: - explicit DeclarativePieSeries(QQuickItem *parent = 0); - QQmlListProperty seriesChildren(); - Q_INVOKABLE QPieSlice *at(int index); - Q_INVOKABLE QPieSlice *find(QString label); - Q_INVOKABLE DeclarativePieSlice *append(QString label, qreal value); - Q_INVOKABLE bool remove(QPieSlice *slice); - Q_INVOKABLE void clear(); - -public: - void classBegin(); - void componentComplete(); - -Q_SIGNALS: - void sliceAdded(QPieSlice *slice); - void sliceRemoved(QPieSlice *slice); - -public Q_SLOTS: - static void appendSeriesChildren(QQmlListProperty *list, QObject *element); - void handleAdded(QList slices); - void handleRemoved(QList slices); -}; - -QT_CHARTS_END_NAMESPACE - -#endif // DECLARATIVEPIESERIES_H diff --git a/src/chartsqml2/declarativepieseries_p.h b/src/chartsqml2/declarativepieseries_p.h new file mode 100644 index 00000000..33ff7586 --- /dev/null +++ b/src/chartsqml2/declarativepieseries_p.h @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the Qt Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef DECLARATIVEPIESERIES_H +#define DECLARATIVEPIESERIES_H + +#include +#include +#include + +#include +#include + +QT_CHARTS_BEGIN_NAMESPACE + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativePieSlice : public QPieSlice +{ + Q_OBJECT + Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged) + +public: + explicit DeclarativePieSlice(QObject *parent = 0); + QString brushFilename() const; + void setBrushFilename(const QString &brushFilename); + +Q_SIGNALS: + void brushFilenameChanged(const QString &brushFilename); + +private Q_SLOTS: + void handleBrushChanged(); + +private: + QString m_brushFilename; + QImage m_brushImage; +}; + +class DeclarativePieSeries : public QPieSeries, public QQmlParserStatus +{ + Q_OBJECT + Q_INTERFACES(QQmlParserStatus) + Q_PROPERTY(QQmlListProperty seriesChildren READ seriesChildren) + Q_CLASSINFO("DefaultProperty", "seriesChildren") + +public: + explicit DeclarativePieSeries(QQuickItem *parent = 0); + QQmlListProperty seriesChildren(); + Q_INVOKABLE QPieSlice *at(int index); + Q_INVOKABLE QPieSlice *find(QString label); + Q_INVOKABLE DeclarativePieSlice *append(QString label, qreal value); + Q_INVOKABLE bool remove(QPieSlice *slice); + Q_INVOKABLE void clear(); + +public: + void classBegin(); + void componentComplete(); + +Q_SIGNALS: + void sliceAdded(QPieSlice *slice); + void sliceRemoved(QPieSlice *slice); + +public Q_SLOTS: + static void appendSeriesChildren(QQmlListProperty *list, QObject *element); + void handleAdded(QList slices); + void handleRemoved(QList slices); +}; + +QT_CHARTS_END_NAMESPACE + +#endif // DECLARATIVEPIESERIES_H diff --git a/src/chartsqml2/declarativepolarchart.cpp b/src/chartsqml2/declarativepolarchart.cpp index bc366d85..b342a6d2 100644 --- a/src/chartsqml2/declarativepolarchart.cpp +++ b/src/chartsqml2/declarativepolarchart.cpp @@ -27,7 +27,7 @@ ** ****************************************************************************/ -#include "declarativepolarchart.h" +#include "declarativepolarchart_p.h" #include QT_CHARTS_BEGIN_NAMESPACE @@ -78,6 +78,6 @@ DeclarativePolarChart::~DeclarativePolarChart() { } -#include "moc_declarativepolarchart.cpp" +#include "moc_declarativepolarchart_p.cpp" QT_CHARTS_END_NAMESPACE diff --git a/src/chartsqml2/declarativepolarchart.h b/src/chartsqml2/declarativepolarchart.h deleted file mode 100644 index beb0f694..00000000 --- a/src/chartsqml2/declarativepolarchart.h +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Charts module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVEPOLARCHART_H -#define DECLARATIVEPOLARCHART_H - -#include -#include - -#include "declarativechart.h" - -QT_CHARTS_BEGIN_NAMESPACE - -class DeclarativePolarChart : public DeclarativeChart -{ - Q_OBJECT -public: - DeclarativePolarChart(QQuickItem *parent = 0); - ~DeclarativePolarChart(); -}; - -QT_CHARTS_END_NAMESPACE - -#endif // DECLARATIVEPOLARCHART_H diff --git a/src/chartsqml2/declarativepolarchart_p.h b/src/chartsqml2/declarativepolarchart_p.h new file mode 100644 index 00000000..3d82f822 --- /dev/null +++ b/src/chartsqml2/declarativepolarchart_p.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the Qt Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef DECLARATIVEPOLARCHART_H +#define DECLARATIVEPOLARCHART_H + +#include +#include +#include +#include + +QT_CHARTS_BEGIN_NAMESPACE + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativePolarChart : public DeclarativeChart +{ + Q_OBJECT +public: + DeclarativePolarChart(QQuickItem *parent = 0); + ~DeclarativePolarChart(); +}; + +QT_CHARTS_END_NAMESPACE + +#endif // DECLARATIVEPOLARCHART_H diff --git a/src/chartsqml2/declarativescatterseries.cpp b/src/chartsqml2/declarativescatterseries.cpp index d62847fb..e53b1984 100644 --- a/src/chartsqml2/declarativescatterseries.cpp +++ b/src/chartsqml2/declarativescatterseries.cpp @@ -27,7 +27,7 @@ ** ****************************************************************************/ -#include "declarativescatterseries.h" +#include "declarativescatterseries_p.h" QT_CHARTS_BEGIN_NAMESPACE @@ -119,6 +119,6 @@ void DeclarativeScatterSeries::handleBrushChanged() } } -#include "moc_declarativescatterseries.cpp" +#include "moc_declarativescatterseries_p.cpp" QT_CHARTS_END_NAMESPACE diff --git a/src/chartsqml2/declarativescatterseries.h b/src/chartsqml2/declarativescatterseries.h deleted file mode 100644 index 9515243a..00000000 --- a/src/chartsqml2/declarativescatterseries.h +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Charts module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVESCATTERSERIES_H -#define DECLARATIVESCATTERSERIES_H - -#include -#include "declarativexyseries.h" -#include "declarativeaxes.h" - -#include -#include - -QT_CHARTS_BEGIN_NAMESPACE - -class DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeries, public QQmlParserStatus -{ - Q_OBJECT - Q_INTERFACES(QQmlParserStatus) - Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) - Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) - Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2) - Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2) - Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3) - Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3) - Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1) - Q_PROPERTY(QQmlListProperty declarativeChildren READ declarativeChildren) - Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 4) - Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged REVISION 4) - Q_CLASSINFO("DefaultProperty", "declarativeChildren") - -public: - explicit DeclarativeScatterSeries(QObject *parent = 0); - QXYSeries *xySeries() { return this; } - QAbstractAxis *axisX() { return m_axes->axisX(); } - void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } - QAbstractAxis *axisY() { return m_axes->axisY(); } - void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } - QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - QAbstractAxis *axisAngular() { return m_axes->axisX(); } - void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); } - QAbstractAxis *axisRadial() { return m_axes->axisY(); } - void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); } - qreal borderWidth() const; - void setBorderWidth(qreal borderWidth); - QQmlListProperty declarativeChildren(); - QString brushFilename() const; - void setBrushFilename(const QString &brushFilename); - void setBrush(const QBrush &brush); - QBrush brush() const; - -public: // from QDeclarativeParserStatus - void classBegin() { DeclarativeXySeries::classBegin(); } - void componentComplete() { DeclarativeXySeries::componentComplete(); } - -public: - Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); } - Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); } - Q_REVISION(3) Q_INVOKABLE void replace(int index, qreal newX, qreal newY) { DeclarativeXySeries::replace(index, newX, newY); } - Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); } - Q_REVISION(3) Q_INVOKABLE void remove(int index) { DeclarativeXySeries::remove(index); } - Q_REVISION(5) Q_INVOKABLE void removePoints(int index, int count) { DeclarativeXySeries::removePoints(index, count); } - Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); } - Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); } - Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); } - -Q_SIGNALS: - void countChanged(int count); - Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); - Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); - Q_REVISION(1) void borderWidthChanged(qreal width); - Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis); - Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis); - Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis); - Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis); - Q_REVISION(4) void brushFilenameChanged(const QString &brushFilename); - Q_REVISION(4) void brushChanged(); - -public Q_SLOTS: - static void appendDeclarativeChildren(QQmlListProperty *list, QObject *element); - void handleCountChanged(int index); - -private Q_SLOTS: - void handleBrushChanged(); - -public: - DeclarativeAxes *m_axes; - -private: - QString m_brushFilename; - QImage m_brushImage; -}; - -QT_CHARTS_END_NAMESPACE - -#endif // DECLARATIVESCATTERSERIES_H diff --git a/src/chartsqml2/declarativescatterseries_p.h b/src/chartsqml2/declarativescatterseries_p.h new file mode 100644 index 00000000..c02ed47e --- /dev/null +++ b/src/chartsqml2/declarativescatterseries_p.h @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the Qt Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef DECLARATIVESCATTERSERIES_H +#define DECLARATIVESCATTERSERIES_H + +#include +#include +#include +#include + +#include +#include + +QT_CHARTS_BEGIN_NAMESPACE + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeries, public QQmlParserStatus +{ + Q_OBJECT + Q_INTERFACES(QQmlParserStatus) + Q_PROPERTY(int count READ count NOTIFY countChanged) + Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) + Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) + Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2) + Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2) + Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3) + Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3) + Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1) + Q_PROPERTY(QQmlListProperty declarativeChildren READ declarativeChildren) + Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 4) + Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged REVISION 4) + Q_CLASSINFO("DefaultProperty", "declarativeChildren") + +public: + explicit DeclarativeScatterSeries(QObject *parent = 0); + QXYSeries *xySeries() { return this; } + QAbstractAxis *axisX() { return m_axes->axisX(); } + void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } + QAbstractAxis *axisY() { return m_axes->axisY(); } + void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } + QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } + void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } + QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } + void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } + QAbstractAxis *axisAngular() { return m_axes->axisX(); } + void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); } + QAbstractAxis *axisRadial() { return m_axes->axisY(); } + void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); } + qreal borderWidth() const; + void setBorderWidth(qreal borderWidth); + QQmlListProperty declarativeChildren(); + QString brushFilename() const; + void setBrushFilename(const QString &brushFilename); + void setBrush(const QBrush &brush); + QBrush brush() const; + +public: // from QDeclarativeParserStatus + void classBegin() { DeclarativeXySeries::classBegin(); } + void componentComplete() { DeclarativeXySeries::componentComplete(); } + +public: + Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); } + Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); } + Q_REVISION(3) Q_INVOKABLE void replace(int index, qreal newX, qreal newY) { DeclarativeXySeries::replace(index, newX, newY); } + Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); } + Q_REVISION(3) Q_INVOKABLE void remove(int index) { DeclarativeXySeries::remove(index); } + Q_REVISION(5) Q_INVOKABLE void removePoints(int index, int count) { DeclarativeXySeries::removePoints(index, count); } + Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); } + Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); } + Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); } + +Q_SIGNALS: + void countChanged(int count); + Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); + Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); + Q_REVISION(1) void borderWidthChanged(qreal width); + Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis); + Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis); + Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis); + Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis); + Q_REVISION(4) void brushFilenameChanged(const QString &brushFilename); + Q_REVISION(4) void brushChanged(); + +public Q_SLOTS: + static void appendDeclarativeChildren(QQmlListProperty *list, QObject *element); + void handleCountChanged(int index); + +private Q_SLOTS: + void handleBrushChanged(); + +public: + DeclarativeAxes *m_axes; + +private: + QString m_brushFilename; + QImage m_brushImage; +}; + +QT_CHARTS_END_NAMESPACE + +#endif // DECLARATIVESCATTERSERIES_H diff --git a/src/chartsqml2/declarativesplineseries.cpp b/src/chartsqml2/declarativesplineseries.cpp index 25e3e873..bcbfef14 100644 --- a/src/chartsqml2/declarativesplineseries.cpp +++ b/src/chartsqml2/declarativesplineseries.cpp @@ -27,7 +27,7 @@ ** ****************************************************************************/ -#include "declarativesplineseries.h" +#include "declarativesplineseries_p.h" QT_CHARTS_BEGIN_NAMESPACE @@ -109,6 +109,6 @@ void DeclarativeSplineSeries::appendDeclarativeChildren(QQmlListProperty -#include "declarativexyseries.h" -#include "declarativeaxes.h" - -#include -#include - -QT_CHARTS_BEGIN_NAMESPACE - -class DeclarativeSplineSeries : public QSplineSeries, public DeclarativeXySeries, public QQmlParserStatus -{ - Q_OBJECT - Q_INTERFACES(QQmlParserStatus) - Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) - Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) - Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2) - Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2) - Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3) - Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3) - Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged REVISION 1) - Q_PROPERTY(Qt::PenStyle style READ style WRITE setStyle NOTIFY styleChanged REVISION 1) - Q_PROPERTY(Qt::PenCapStyle capStyle READ capStyle WRITE setCapStyle NOTIFY capStyleChanged REVISION 1) - Q_PROPERTY(QQmlListProperty declarativeChildren READ declarativeChildren) - Q_CLASSINFO("DefaultProperty", "declarativeChildren") - -public: - explicit DeclarativeSplineSeries(QObject *parent = 0); - QXYSeries *xySeries() { return this; } - QAbstractAxis *axisX() { return m_axes->axisX(); } - void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } - QAbstractAxis *axisY() { return m_axes->axisY(); } - void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } - QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - QAbstractAxis *axisAngular() { return m_axes->axisX(); } - void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); } - QAbstractAxis *axisRadial() { return m_axes->axisY(); } - void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); } - qreal width() const; - void setWidth(qreal width); - Qt::PenStyle style() const; - void setStyle(Qt::PenStyle style); - Qt::PenCapStyle capStyle() const; - void setCapStyle(Qt::PenCapStyle capStyle); - QQmlListProperty declarativeChildren(); - -public: // from QDeclarativeParserStatus - void classBegin() { DeclarativeXySeries::classBegin(); } - void componentComplete() { DeclarativeXySeries::componentComplete(); } - -public: - Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); } - Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); } - Q_REVISION(3) Q_INVOKABLE void replace(int index, qreal newX, qreal newY) { DeclarativeXySeries::replace(index, newX, newY); } - Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); } - Q_REVISION(3) Q_INVOKABLE void remove(int index) { DeclarativeXySeries::remove(index); } - Q_REVISION(4) Q_INVOKABLE void removePoints(int index, int count) { DeclarativeXySeries::removePoints(index, count); } - Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); } - Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); } - Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); } - -Q_SIGNALS: - void countChanged(int count); - Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); - Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); - Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis); - Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis); - Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis); - Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis); - Q_REVISION(1) void widthChanged(qreal width); - Q_REVISION(1) void styleChanged(Qt::PenStyle style); - Q_REVISION(1) void capStyleChanged(Qt::PenCapStyle capStyle); - -public Q_SLOTS: - static void appendDeclarativeChildren(QQmlListProperty *list, QObject *element); - void handleCountChanged(int index); - -public: - DeclarativeAxes *m_axes; -}; - -QT_CHARTS_END_NAMESPACE - -#endif // DECLARATIVESPLINESERIES_H diff --git a/src/chartsqml2/declarativesplineseries_p.h b/src/chartsqml2/declarativesplineseries_p.h new file mode 100644 index 00000000..d6369a87 --- /dev/null +++ b/src/chartsqml2/declarativesplineseries_p.h @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the Qt Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef DECLARATIVESPLINESERIES_H +#define DECLARATIVESPLINESERIES_H + +#include +#include +#include +#include + +#include +#include + +QT_CHARTS_BEGIN_NAMESPACE + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativeSplineSeries : public QSplineSeries, public DeclarativeXySeries, public QQmlParserStatus +{ + Q_OBJECT + Q_INTERFACES(QQmlParserStatus) + Q_PROPERTY(int count READ count NOTIFY countChanged) + Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) + Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) + Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2) + Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2) + Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3) + Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3) + Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged REVISION 1) + Q_PROPERTY(Qt::PenStyle style READ style WRITE setStyle NOTIFY styleChanged REVISION 1) + Q_PROPERTY(Qt::PenCapStyle capStyle READ capStyle WRITE setCapStyle NOTIFY capStyleChanged REVISION 1) + Q_PROPERTY(QQmlListProperty declarativeChildren READ declarativeChildren) + Q_CLASSINFO("DefaultProperty", "declarativeChildren") + +public: + explicit DeclarativeSplineSeries(QObject *parent = 0); + QXYSeries *xySeries() { return this; } + QAbstractAxis *axisX() { return m_axes->axisX(); } + void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); } + QAbstractAxis *axisY() { return m_axes->axisY(); } + void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); } + QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } + void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } + QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } + void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } + QAbstractAxis *axisAngular() { return m_axes->axisX(); } + void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); } + QAbstractAxis *axisRadial() { return m_axes->axisY(); } + void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); } + qreal width() const; + void setWidth(qreal width); + Qt::PenStyle style() const; + void setStyle(Qt::PenStyle style); + Qt::PenCapStyle capStyle() const; + void setCapStyle(Qt::PenCapStyle capStyle); + QQmlListProperty declarativeChildren(); + +public: // from QDeclarativeParserStatus + void classBegin() { DeclarativeXySeries::classBegin(); } + void componentComplete() { DeclarativeXySeries::componentComplete(); } + +public: + Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); } + Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); } + Q_REVISION(3) Q_INVOKABLE void replace(int index, qreal newX, qreal newY) { DeclarativeXySeries::replace(index, newX, newY); } + Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); } + Q_REVISION(3) Q_INVOKABLE void remove(int index) { DeclarativeXySeries::remove(index); } + Q_REVISION(4) Q_INVOKABLE void removePoints(int index, int count) { DeclarativeXySeries::removePoints(index, count); } + Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); } + Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); } + Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); } + +Q_SIGNALS: + void countChanged(int count); + Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); + Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); + Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis); + Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis); + Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis); + Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis); + Q_REVISION(1) void widthChanged(qreal width); + Q_REVISION(1) void styleChanged(Qt::PenStyle style); + Q_REVISION(1) void capStyleChanged(Qt::PenCapStyle capStyle); + +public Q_SLOTS: + static void appendDeclarativeChildren(QQmlListProperty *list, QObject *element); + void handleCountChanged(int index); + +public: + DeclarativeAxes *m_axes; +}; + +QT_CHARTS_END_NAMESPACE + +#endif // DECLARATIVESPLINESERIES_H diff --git a/src/chartsqml2/declarativexypoint.cpp b/src/chartsqml2/declarativexypoint.cpp index 91ade7c2..332ea165 100644 --- a/src/chartsqml2/declarativexypoint.cpp +++ b/src/chartsqml2/declarativexypoint.cpp @@ -27,7 +27,7 @@ ** ****************************************************************************/ -#include "declarativexypoint.h" +#include "declarativexypoint_p.h" #include QT_CHARTS_BEGIN_NAMESPACE @@ -62,6 +62,6 @@ DeclarativeXYPoint::DeclarativeXYPoint(QObject *parent) : setY(0.0); } -#include "moc_declarativexypoint.cpp" +#include "moc_declarativexypoint_p.cpp" QT_CHARTS_END_NAMESPACE diff --git a/src/chartsqml2/declarativexypoint.h b/src/chartsqml2/declarativexypoint.h deleted file mode 100644 index feb0af05..00000000 --- a/src/chartsqml2/declarativexypoint.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Charts module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVE_XY_POINT_H -#define DECLARATIVE_XY_POINT_H - -#include -#include -#include - -QT_CHARTS_BEGIN_NAMESPACE - -class DeclarativeXYPoint : public QObject, public QPointF -{ - Q_OBJECT - Q_PROPERTY(qreal x READ x WRITE setX) - Q_PROPERTY(qreal y READ y WRITE setY) - -public: - explicit DeclarativeXYPoint(QObject *parent = 0); -}; - -QT_CHARTS_END_NAMESPACE - -#endif // DECLARATIVE_XY_POINT_H diff --git a/src/chartsqml2/declarativexypoint_p.h b/src/chartsqml2/declarativexypoint_p.h new file mode 100644 index 00000000..316ff962 --- /dev/null +++ b/src/chartsqml2/declarativexypoint_p.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the Qt Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef DECLARATIVE_XY_POINT_H +#define DECLARATIVE_XY_POINT_H + +#include +#include +#include +#include + +QT_CHARTS_BEGIN_NAMESPACE + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativeXYPoint : public QObject, public QPointF +{ + Q_OBJECT + Q_PROPERTY(qreal x READ x WRITE setX) + Q_PROPERTY(qreal y READ y WRITE setY) + +public: + explicit DeclarativeXYPoint(QObject *parent = 0); +}; + +QT_CHARTS_END_NAMESPACE + +#endif // DECLARATIVE_XY_POINT_H diff --git a/src/chartsqml2/declarativexyseries.cpp b/src/chartsqml2/declarativexyseries.cpp index 1d38cf68..88c971e9 100644 --- a/src/chartsqml2/declarativexyseries.cpp +++ b/src/chartsqml2/declarativexyseries.cpp @@ -28,8 +28,8 @@ ****************************************************************************/ -#include "declarativexyseries.h" -#include "declarativexypoint.h" +#include "declarativexyseries_p.h" +#include "declarativexypoint_p.h" #include #include diff --git a/src/chartsqml2/declarativexyseries.h b/src/chartsqml2/declarativexyseries.h deleted file mode 100644 index 26da8c42..00000000 --- a/src/chartsqml2/declarativexyseries.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Charts module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVE_XY_SERIES_H -#define DECLARATIVE_XY_SERIES_H - -#include - -QT_CHARTS_BEGIN_NAMESPACE - -class QChart; -class QAbstractSeries; - -class DeclarativeXySeries -{ -public: - explicit DeclarativeXySeries(); - ~DeclarativeXySeries(); - -public: - void classBegin(); - void componentComplete(); - virtual QXYSeries *xySeries() = 0; - - void append(qreal x, qreal y); - void replace(qreal oldX, qreal oldY, qreal newX, qreal newY); - void replace(int index, qreal newX, qreal newY); - void remove(qreal x, qreal y); - void remove(int index); - void removePoints(int index, int count); - void insert(int index, qreal x, qreal y); - void clear(); - QPointF at(int index); -}; - -QT_CHARTS_END_NAMESPACE - -#endif // DECLARATIVE_XY_SERIES_H diff --git a/src/chartsqml2/declarativexyseries_p.h b/src/chartsqml2/declarativexyseries_p.h new file mode 100644 index 00000000..e78fde67 --- /dev/null +++ b/src/chartsqml2/declarativexyseries_p.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the Qt Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef DECLARATIVE_XY_SERIES_H +#define DECLARATIVE_XY_SERIES_H + +#include +#include + +QT_CHARTS_BEGIN_NAMESPACE + +class QChart; +class QAbstractSeries; + +class QT_QMLCHARTS_PRIVATE_EXPORT DeclarativeXySeries +{ +public: + explicit DeclarativeXySeries(); + ~DeclarativeXySeries(); + +public: + void classBegin(); + void componentComplete(); + virtual QXYSeries *xySeries() = 0; + + void append(qreal x, qreal y); + void replace(qreal oldX, qreal oldY, qreal newX, qreal newY); + void replace(int index, qreal newX, qreal newY); + void remove(qreal x, qreal y); + void remove(int index); + void removePoints(int index, int count); + void insert(int index, qreal x, qreal y); + void clear(); + QPointF at(int index); +}; + +QT_CHARTS_END_NAMESPACE + +#endif // DECLARATIVE_XY_SERIES_H diff --git a/sync.profile b/sync.profile index 80332926..f21cc199 100644 --- a/sync.profile +++ b/sync.profile @@ -1,5 +1,5 @@ %modules = ( # path to module name map - "QtCharts" => "$basedir/src/charts", + "QtCharts" => "$basedir/src/charts;^$basedir/src/chartsqml2", ); %moduleheaders = ( # restrict the module headers to those found in relative path ); -- cgit v1.2.3