diff options
Diffstat (limited to 'plugins/declarative')
31 files changed, 0 insertions, 5271 deletions
diff --git a/plugins/declarative/declarative.pri b/plugins/declarative/declarative.pri deleted file mode 100644 index e652c7c4..00000000 --- a/plugins/declarative/declarative.pri +++ /dev/null @@ -1,60 +0,0 @@ -!include( ../plugins.pri ) { - error( "Couldn't find the plugins.pri file!" ) -} - -contains(DEFINES, CHARTS_FOR_QUICK2) { - DESTDIR = $$CHART_BUILD_QML2_PLUGIN_DIR -} else { - DESTDIR = $$CHART_BUILD_QML_PLUGIN_DIR -} - -INCLUDEPATH += $$CHART_BUILD_PRIVATE_HEADER_DIR -ios:CONFIG(iphonesimulator, iphonesimulator|iphoneos):TARGET = $$join(TARGET,,,_iphonesimulator) -CONFIG(debug, debug|release) { - mac: TARGET = $$join(TARGET,,,_debug) - win32: TARGET = $$join(TARGET,,,d) -} - -SOURCES += \ - ../declarative/plugin.cpp \ - ../declarative/declarativechart.cpp \ - ../declarative/declarativexypoint.cpp \ - ../declarative/declarativexyseries.cpp \ - ../declarative/declarativelineseries.cpp \ - ../declarative/declarativesplineseries.cpp \ - ../declarative/declarativeareaseries.cpp \ - ../declarative/declarativescatterseries.cpp \ - ../declarative/declarativepieseries.cpp \ - ../declarative/declarativebarseries.cpp \ - ../declarative/declarativecategoryaxis.cpp \ - ../declarative/declarativemargins.cpp \ - ../declarative/declarativeaxes.cpp \ - ../declarative/declarativepolarchart.cpp \ - ../declarative/declarativeboxplotseries.cpp - -HEADERS += \ - ../declarative/declarativechart.h \ - ../declarative/declarativexypoint.h \ - ../declarative/declarativexyseries.h \ - ../declarative/declarativelineseries.h \ - ../declarative/declarativesplineseries.h \ - ../declarative/declarativeareaseries.h \ - ../declarative/declarativescatterseries.h \ - ../declarative/declarativepieseries.h \ - ../declarative/declarativebarseries.h \ - ../declarative/declarativecategoryaxis.h \ - ../declarative/declarativemargins.h \ - ../declarative/declarativeaxes.h \ - ../declarative/declarativepolarchart.h \ - ../declarative/shared_defines.h \ - ../declarative/declarativeboxplotseries.h - -TARGETPATH = QtCommercial/Chart -target.path = $$IMPORT_INSTALL_PATH/$$TARGETPATH -qmldir.files += $$_PRO_FILE_PWD_/qmldir -qmldir.path += $$IMPORT_INSTALL_PATH/$$TARGETPATH -INSTALLS += target qmldir - -QMLDIR_FILE = $$_PRO_FILE_PWD_/qmldir -contains(QMAKE_HOST.os, Windows): QMLDIR_FILE = $$replace(QMLDIR_FILE, "/","\\") -QMAKE_POST_LINK += $$QMAKE_COPY $$QMLDIR_FILE $$DESTDIR diff --git a/plugins/declarative/declarativeareaseries.cpp b/plugins/declarative/declarativeareaseries.cpp deleted file mode 100644 index 206550c2..00000000 --- a/plugins/declarative/declarativeareaseries.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "declarativeareaseries.h" -#include "declarativelineseries.h" - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -DeclarativeAreaSeries::DeclarativeAreaSeries(QObject *parent) : - QAreaSeries(parent), - m_axes(new DeclarativeAxes(this)) -{ - connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisAngularChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisRadialChanged(QAbstractAxis*))); - connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged())); -} - -void DeclarativeAreaSeries::setUpperSeries(DeclarativeLineSeries *series) -{ - QAreaSeries::setUpperSeries(series); -} - -DeclarativeLineSeries *DeclarativeAreaSeries::upperSeries() const -{ - return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::upperSeries()); -} - -void DeclarativeAreaSeries::setLowerSeries(DeclarativeLineSeries *series) -{ - QAreaSeries::setLowerSeries(series); -} - -DeclarativeLineSeries *DeclarativeAreaSeries::lowerSeries() const -{ - return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::lowerSeries()); -} - -qreal DeclarativeAreaSeries::borderWidth() const -{ - return pen().widthF(); -} - -void DeclarativeAreaSeries::setBorderWidth(qreal width) -{ - if (width != pen().widthF()) { - QPen p = pen(); - p.setWidthF(width); - setPen(p); - emit borderWidthChanged(width); - } -} - -QString DeclarativeAreaSeries::brushFilename() const -{ - return m_brushFilename; -} - -void DeclarativeAreaSeries::setBrushFilename(const QString &brushFilename) -{ - QImage brushImage(brushFilename); - if (QAreaSeries::brush().textureImage() != brushImage) { - QBrush brush = QAreaSeries::brush(); - brush.setTextureImage(brushImage); - QAreaSeries::setBrush(brush); - m_brushFilename = brushFilename; - m_brushImage = brushImage; - emit brushFilenameChanged(brushFilename); - } -} - -void DeclarativeAreaSeries::handleBrushChanged() -{ - // If the texture image of the brush has changed along the brush - // the brush file name needs to be cleared. - if (!m_brushFilename.isEmpty() && QAreaSeries::brush().textureImage() != m_brushImage) { - m_brushFilename.clear(); - emit brushFilenameChanged(QString("")); - } -} - -void DeclarativeAreaSeries::setBrush(const QBrush &brush) -{ - QAreaSeries::setBrush(brush); - emit brushChanged(); -} - -QBrush DeclarativeAreaSeries::brush() const -{ - return QAreaSeries::brush(); -} - -#include "moc_declarativeareaseries.cpp" - -QTCOMMERCIALCHART_END_NAMESPACE diff --git a/plugins/declarative/declarativeareaseries.h b/plugins/declarative/declarativeareaseries.h deleted file mode 100644 index fd638ae6..00000000 --- a/plugins/declarative/declarativeareaseries.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVEAREASERIES_H -#define DECLARATIVEAREASERIES_H - -#include "qareaseries.h" -#include "declarativeaxes.h" - -QTCOMMERCIALCHART_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); } - Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - Q_REVISION(3) QAbstractAxis *axisAngular() { return m_axes->axisX(); } - Q_REVISION(3) void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); } - Q_REVISION(3) QAbstractAxis *axisRadial() { return m_axes->axisY(); } - Q_REVISION(3) 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; -}; - -QTCOMMERCIALCHART_END_NAMESPACE - -#endif // DECLARATIVEAREASERIES_H diff --git a/plugins/declarative/declarativeaxes.cpp b/plugins/declarative/declarativeaxes.cpp deleted file mode 100644 index b7319274..00000000 --- a/plugins/declarative/declarativeaxes.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "declarativeaxes.h" -#include "qabstractaxis.h" - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -DeclarativeAxes::DeclarativeAxes(QObject *parent) : - QObject(parent), - m_axisX(0), - m_axisY(0), - m_axisXTop(0), - m_axisYRight(0) -{ -} - -void DeclarativeAxes::setAxisX(QAbstractAxis *axis) -{ - m_axisX = axis; - emit axisXChanged(axis); -} - -void DeclarativeAxes::setAxisY(QAbstractAxis *axis) -{ - m_axisY = axis; - emit axisYChanged(axis); -} - -void DeclarativeAxes::setAxisXTop(QAbstractAxis *axis) -{ - m_axisXTop = axis; - emit axisXTopChanged(axis); -} - -void DeclarativeAxes::setAxisYRight(QAbstractAxis *axis) -{ - m_axisYRight = axis; - emit axisYRightChanged(axis); -} - -#include "moc_declarativeaxes.cpp" - -QTCOMMERCIALCHART_END_NAMESPACE diff --git a/plugins/declarative/declarativeaxes.h b/plugins/declarative/declarativeaxes.h deleted file mode 100644 index d7ebbb52..00000000 --- a/plugins/declarative/declarativeaxes.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVEAXES_H -#define DECLARATIVEAXES_H - -#include "qchartglobal.h" -#include <QObject> - -QTCOMMERCIALCHART_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); } - -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; -}; - -QTCOMMERCIALCHART_END_NAMESPACE - -#endif // DECLARATIVEAXES_H diff --git a/plugins/declarative/declarativebarseries.cpp b/plugins/declarative/declarativebarseries.cpp deleted file mode 100644 index 1e734bb6..00000000 --- a/plugins/declarative/declarativebarseries.cpp +++ /dev/null @@ -1,509 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "declarativebarseries.h" -#include "qbarset.h" -#include "qvbarmodelmapper.h" -#include "qhbarmodelmapper.h" - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -DeclarativeBarSet::DeclarativeBarSet(QObject *parent) - : QBarSet("", parent) -{ - connect(this, SIGNAL(valuesAdded(int,int)), this, SLOT(handleCountChanged(int,int))); - connect(this, SIGNAL(valuesRemoved(int,int)), this, SLOT(handleCountChanged(int,int))); - connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged())); -} - -void DeclarativeBarSet::handleCountChanged(int index, int count) -{ - Q_UNUSED(index) - Q_UNUSED(count) - emit countChanged(QBarSet::count()); -} - -qreal DeclarativeBarSet::borderWidth() const -{ - return pen().widthF(); -} - -void DeclarativeBarSet::setBorderWidth(qreal width) -{ - if (width != pen().widthF()) { - QPen p = pen(); - p.setWidthF(width); - setPen(p); - emit borderWidthChanged(width); - } -} - -QVariantList DeclarativeBarSet::values() -{ - QVariantList values; - for (int i(0); i < count(); i++) - values.append(QVariant(QBarSet::at(i))); - return values; -} - -void DeclarativeBarSet::setValues(QVariantList values) -{ - while (count()) - remove(count() - 1); - - if (values.at(0).canConvert(QVariant::Point)) { - // Create list of values for appending if the first item is Qt.point - int maxValue = 0; - for (int i = 0; i < values.count(); i++) { - if (values.at(i).canConvert(QVariant::Point) && - values.at(i).toPoint().x() > maxValue) { - maxValue = values.at(i).toPoint().x(); - } - } - - QVector<int> indexValueList; - indexValueList.resize(maxValue + 1); - - for (int i = 0; i < values.count(); i++) { - if (values.at(i).canConvert(QVariant::Point)) { - indexValueList.replace(values.at(i).toPoint().x(), values.at(i).toPoint().y()); - } - } - - for (int i = 0; i < indexValueList.count(); i++) - QBarSet::append(indexValueList.at(i)); - - } else { - for (int i(0); i < values.count(); i++) { - if (values.at(i).canConvert(QVariant::Double)) - QBarSet::append(values[i].toDouble()); - } - } -} - -QString DeclarativeBarSet::brushFilename() const -{ - return m_brushFilename; -} - -void DeclarativeBarSet::setBrushFilename(const QString &brushFilename) -{ - QImage brushImage(brushFilename); - if (QBarSet::brush().textureImage() != brushImage) { - QBrush brush = QBarSet::brush(); - brush.setTextureImage(brushImage); - QBarSet::setBrush(brush); - m_brushFilename = brushFilename; - m_brushImage = brushImage; - emit brushFilenameChanged(brushFilename); - } -} - -void DeclarativeBarSet::handleBrushChanged() -{ - // If the texture image of the brush has changed along the brush - // the brush file name needs to be cleared. - if (!m_brushFilename.isEmpty() && QBarSet::brush().textureImage() != m_brushImage) { - m_brushFilename.clear(); - emit brushFilenameChanged(QString("")); - } -} - -// Declarative bar series ====================================================================================== -DeclarativeBarSeries::DeclarativeBarSeries(QDECLARATIVE_ITEM *parent) : - QBarSeries(parent), - m_axes(new DeclarativeAxes(this)) -{ - connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*))); -} - -void DeclarativeBarSeries::classBegin() -{ -} - -void DeclarativeBarSeries::componentComplete() -{ - foreach (QObject *child, children()) { - if (qobject_cast<DeclarativeBarSet *>(child)) { - QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child)); - } else if (qobject_cast<QVBarModelMapper *>(child)) { - QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child); - mapper->setSeries(this); - } else if (qobject_cast<QHBarModelMapper *>(child)) { - QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child); - mapper->setSeries(this); - } - } -} - -QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeBarSeries::seriesChildren() -{ - return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS); -} - -void DeclarativeBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element) -{ - // Empty implementation; the children are parsed in componentComplete instead - Q_UNUSED(list); - Q_UNUSED(element); -} - -DeclarativeBarSet *DeclarativeBarSeries::at(int index) -{ - QList<QBarSet *> setList = barSets(); - if (index >= 0 && index < setList.count()) - return qobject_cast<DeclarativeBarSet *>(setList[index]); - - return 0; -} - -DeclarativeBarSet *DeclarativeBarSeries::insert(int index, QString label, QVariantList values) -{ - DeclarativeBarSet *barset = new DeclarativeBarSet(this); - barset->setLabel(label); - barset->setValues(values); - if (QBarSeries::insert(index, barset)) - return barset; - delete barset; - return 0; -} - -// Declarative stacked bar series ============================================================================== -DeclarativeStackedBarSeries::DeclarativeStackedBarSeries(QDECLARATIVE_ITEM *parent) : - QStackedBarSeries(parent), - m_axes(0) -{ - m_axes = new DeclarativeAxes(this); - connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*))); -} - -void DeclarativeStackedBarSeries::classBegin() -{ -} - -void DeclarativeStackedBarSeries::componentComplete() -{ - foreach (QObject *child, children()) { - if (qobject_cast<DeclarativeBarSet *>(child)) { - QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child)); - } else if (qobject_cast<QVBarModelMapper *>(child)) { - QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child); - mapper->setSeries(this); - } else if (qobject_cast<QHBarModelMapper *>(child)) { - QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child); - mapper->setSeries(this); - } - } -} - - -QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeStackedBarSeries::seriesChildren() -{ - return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS); -} - -void DeclarativeStackedBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element) -{ - // Empty implementation; the children are parsed in componentComplete instead - Q_UNUSED(list); - Q_UNUSED(element); -} - -DeclarativeBarSet *DeclarativeStackedBarSeries::at(int index) -{ - QList<QBarSet *> setList = barSets(); - if (index >= 0 && index < setList.count()) - return qobject_cast<DeclarativeBarSet *>(setList[index]); - - return 0; -} - -DeclarativeBarSet *DeclarativeStackedBarSeries::insert(int index, QString label, QVariantList values) -{ - DeclarativeBarSet *barset = new DeclarativeBarSet(this); - barset->setLabel(label); - barset->setValues(values); - if (QStackedBarSeries::insert(index, barset)) - return barset; - delete barset; - return 0; -} - -// Declarative percent bar series ============================================================================== -DeclarativePercentBarSeries::DeclarativePercentBarSeries(QDECLARATIVE_ITEM *parent) : - QPercentBarSeries(parent), - m_axes(0) -{ - m_axes = new DeclarativeAxes(this); - connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*))); -} - -void DeclarativePercentBarSeries::classBegin() -{ -} - -void DeclarativePercentBarSeries::componentComplete() -{ - foreach (QObject *child, children()) { - if (qobject_cast<DeclarativeBarSet *>(child)) { - QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child)); - } else if (qobject_cast<QVBarModelMapper *>(child)) { - QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child); - mapper->setSeries(this); - } else if (qobject_cast<QHBarModelMapper *>(child)) { - QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child); - mapper->setSeries(this); - } - } -} - -QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativePercentBarSeries::seriesChildren() -{ - return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS); -} - -void DeclarativePercentBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element) -{ - // Empty implementation; the children are parsed in componentComplete instead - Q_UNUSED(list); - Q_UNUSED(element); -} - -DeclarativeBarSet *DeclarativePercentBarSeries::at(int index) -{ - QList<QBarSet *> setList = barSets(); - if (index >= 0 && index < setList.count()) - return qobject_cast<DeclarativeBarSet *>(setList[index]); - - return 0; -} - -DeclarativeBarSet *DeclarativePercentBarSeries::insert(int index, QString label, QVariantList values) -{ - DeclarativeBarSet *barset = new DeclarativeBarSet(this); - barset->setLabel(label); - barset->setValues(values); - if (QPercentBarSeries::insert(index, barset)) - return barset; - delete barset; - return 0; -} - -// Declarative horizontal bar series =========================================================================== -DeclarativeHorizontalBarSeries::DeclarativeHorizontalBarSeries(QDECLARATIVE_ITEM *parent) : - QHorizontalBarSeries(parent), - m_axes(0) -{ - m_axes = new DeclarativeAxes(this); - connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*))); -} - -void DeclarativeHorizontalBarSeries::classBegin() -{ -} - -void DeclarativeHorizontalBarSeries::componentComplete() -{ - foreach (QObject *child, children()) { - if (qobject_cast<DeclarativeBarSet *>(child)) { - QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child)); - } else if (qobject_cast<QVBarModelMapper *>(child)) { - QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child); - mapper->setSeries(this); - } else if (qobject_cast<QHBarModelMapper *>(child)) { - QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child); - mapper->setSeries(this); - } - } -} - -QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeHorizontalBarSeries::seriesChildren() -{ - return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeHorizontalBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS); -} - -void DeclarativeHorizontalBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element) -{ - // Empty implementation; the children are parsed in componentComplete instead - Q_UNUSED(list); - Q_UNUSED(element); -} - -DeclarativeBarSet *DeclarativeHorizontalBarSeries::at(int index) -{ - QList<QBarSet *> setList = barSets(); - if (index >= 0 && index < setList.count()) - return qobject_cast<DeclarativeBarSet *>(setList[index]); - - return 0; -} - -DeclarativeBarSet *DeclarativeHorizontalBarSeries::insert(int index, QString label, QVariantList values) -{ - DeclarativeBarSet *barset = new DeclarativeBarSet(this); - barset->setLabel(label); - barset->setValues(values); - if (QHorizontalBarSeries::insert(index, barset)) - return barset; - delete barset; - return 0; -} - -// Declarative horizontal stacked bar series =================================================================== -DeclarativeHorizontalStackedBarSeries::DeclarativeHorizontalStackedBarSeries(QDECLARATIVE_ITEM *parent) : - QHorizontalStackedBarSeries(parent), - m_axes(0) -{ - m_axes = new DeclarativeAxes(this); - connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*))); -} - -void DeclarativeHorizontalStackedBarSeries::classBegin() -{ -} - -void DeclarativeHorizontalStackedBarSeries::componentComplete() -{ - foreach (QObject *child, children()) { - if (qobject_cast<DeclarativeBarSet *>(child)) { - QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child)); - } else if (qobject_cast<QVBarModelMapper *>(child)) { - QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child); - mapper->setSeries(this); - } else if (qobject_cast<QHBarModelMapper *>(child)) { - QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child); - mapper->setSeries(this); - } - } -} - -QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeHorizontalStackedBarSeries::seriesChildren() -{ - return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeHorizontalStackedBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS); -} - -void DeclarativeHorizontalStackedBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element) -{ - // Empty implementation; the children are parsed in componentComplete instead - Q_UNUSED(list); - Q_UNUSED(element); -} - -DeclarativeBarSet *DeclarativeHorizontalStackedBarSeries::at(int index) -{ - QList<QBarSet *> setList = barSets(); - if (index >= 0 && index < setList.count()) - return qobject_cast<DeclarativeBarSet *>(setList[index]); - - return 0; -} - -DeclarativeBarSet *DeclarativeHorizontalStackedBarSeries::insert(int index, QString label, QVariantList values) -{ - DeclarativeBarSet *barset = new DeclarativeBarSet(this); - barset->setLabel(label); - barset->setValues(values); - if (QHorizontalStackedBarSeries::insert(index, barset)) - return barset; - delete barset; - return 0; -} - -// Declarative horizontal percent bar series =================================================================== -DeclarativeHorizontalPercentBarSeries::DeclarativeHorizontalPercentBarSeries(QDECLARATIVE_ITEM *parent) : - QHorizontalPercentBarSeries(parent), - m_axes(0) -{ - m_axes = new DeclarativeAxes(this); - connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*))); -} - -void DeclarativeHorizontalPercentBarSeries::classBegin() -{ -} - -void DeclarativeHorizontalPercentBarSeries::componentComplete() -{ - foreach (QObject *child, children()) { - if (qobject_cast<DeclarativeBarSet *>(child)) { - QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child)); - } else if (qobject_cast<QVBarModelMapper *>(child)) { - QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child); - mapper->setSeries(this); - } else if (qobject_cast<QHBarModelMapper *>(child)) { - QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child); - mapper->setSeries(this); - } - } -} - -QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeHorizontalPercentBarSeries::seriesChildren() -{ - return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeHorizontalPercentBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS); -} - -void DeclarativeHorizontalPercentBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element) -{ - // Empty implementation; the children are parsed in componentComplete instead - Q_UNUSED(list); - Q_UNUSED(element); -} - -DeclarativeBarSet *DeclarativeHorizontalPercentBarSeries::at(int index) -{ - QList<QBarSet *> setList = barSets(); - if (index >= 0 && index < setList.count()) - return qobject_cast<DeclarativeBarSet *>(setList[index]); - - return 0; -} - -DeclarativeBarSet *DeclarativeHorizontalPercentBarSeries::insert(int index, QString label, QVariantList values) -{ - DeclarativeBarSet *barset = new DeclarativeBarSet(this); - barset->setLabel(label); - barset->setValues(values); - if (QHorizontalPercentBarSeries::insert(index, barset)) - return barset; - delete barset; - return 0; -} - -#include "moc_declarativebarseries.cpp" - -QTCOMMERCIALCHART_END_NAMESPACE diff --git a/plugins/declarative/declarativebarseries.h b/plugins/declarative/declarativebarseries.h deleted file mode 100644 index 7b85f490..00000000 --- a/plugins/declarative/declarativebarseries.h +++ /dev/null @@ -1,415 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVEBARSERIES_H -#define DECLARATIVEBARSERIES_H - -#include "qbarseries.h" -#include "qstackedbarseries.h" -#include "qpercentbarseries.h" -#include "qhorizontalbarseries.h" -#include "qhorizontalstackedbarseries.h" -#include "qhorizontalpercentbarseries.h" -#include "qbarset.h" -#include "declarativeaxes.h" -#include "shared_defines.h" - -#ifdef CHARTS_FOR_QUICK2 -#include <QtQuick/QQuickItem> -#include <QtQml/QQmlParserStatus> -#else -#include <QtDeclarative/QDeclarativeItem> -#include <QtDeclarative/QDeclarativeParserStatus> -#endif - -QTCOMMERCIALCHART_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 QDECLARATIVE_PARSER_STATUS -{ - Q_OBJECT -#ifdef CHARTS_FOR_QUICK2 - Q_INTERFACES(QQmlParserStatus) -#else - Q_INTERFACES(QDeclarativeParserStatus) -#endif - 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) -#ifdef CHARTS_FOR_QUICK2 - Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren) -#else - Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren) -#endif - Q_CLASSINFO("DefaultProperty", "seriesChildren") - -public: - explicit DeclarativeBarSeries(QDECLARATIVE_ITEM *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); } - Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - QDECLARATIVE_LIST_PROPERTY<QObject> 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(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element); - -public: - DeclarativeAxes *m_axes; -}; - -class DeclarativeStackedBarSeries : public QStackedBarSeries, public QDECLARATIVE_PARSER_STATUS -{ - Q_OBJECT -#ifdef CHARTS_FOR_QUICK2 - Q_INTERFACES(QQmlParserStatus) -#else - Q_INTERFACES(QDeclarativeParserStatus) -#endif - 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) -#ifdef CHARTS_FOR_QUICK2 - Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren) -#else - Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren) -#endif - Q_CLASSINFO("DefaultProperty", "seriesChildren") - -public: - explicit DeclarativeStackedBarSeries(QDECLARATIVE_ITEM *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); } - Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - QDECLARATIVE_LIST_PROPERTY<QObject> 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(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element); - -public: - DeclarativeAxes *m_axes; -}; - -class DeclarativePercentBarSeries : public QPercentBarSeries, public QDECLARATIVE_PARSER_STATUS -{ - Q_OBJECT -#ifdef CHARTS_FOR_QUICK2 - Q_INTERFACES(QQmlParserStatus) -#else - Q_INTERFACES(QDeclarativeParserStatus) -#endif - 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) -#ifdef CHARTS_FOR_QUICK2 - Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren) -#else - Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren) -#endif - Q_CLASSINFO("DefaultProperty", "seriesChildren") - -public: - explicit DeclarativePercentBarSeries(QDECLARATIVE_ITEM *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); } - Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - QDECLARATIVE_LIST_PROPERTY<QObject> 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(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element); - -public: - DeclarativeAxes *m_axes; -}; - -class DeclarativeHorizontalBarSeries : public QHorizontalBarSeries, public QDECLARATIVE_PARSER_STATUS -{ - Q_OBJECT -#ifdef CHARTS_FOR_QUICK2 - Q_INTERFACES(QQmlParserStatus) -#else - Q_INTERFACES(QDeclarativeParserStatus) -#endif - 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) -#ifdef CHARTS_FOR_QUICK2 - Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren) -#else - Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren) -#endif - Q_CLASSINFO("DefaultProperty", "seriesChildren") - -public: - explicit DeclarativeHorizontalBarSeries(QDECLARATIVE_ITEM *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); } - Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - QDECLARATIVE_LIST_PROPERTY<QObject> 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(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element); - -public: - DeclarativeAxes *m_axes; -}; - -class DeclarativeHorizontalStackedBarSeries : public QHorizontalStackedBarSeries, public QDECLARATIVE_PARSER_STATUS -{ - Q_OBJECT -#ifdef CHARTS_FOR_QUICK2 - Q_INTERFACES(QQmlParserStatus) -#else - Q_INTERFACES(QDeclarativeParserStatus) -#endif - 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) -#ifdef CHARTS_FOR_QUICK2 - Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren) -#else - Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren) -#endif - Q_CLASSINFO("DefaultProperty", "seriesChildren") - -public: - explicit DeclarativeHorizontalStackedBarSeries(QDECLARATIVE_ITEM *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); } - Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - QDECLARATIVE_LIST_PROPERTY<QObject> 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(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element); - -public: - DeclarativeAxes *m_axes; -}; - -class DeclarativeHorizontalPercentBarSeries : public QHorizontalPercentBarSeries, public QDECLARATIVE_PARSER_STATUS -{ - Q_OBJECT -#ifdef CHARTS_FOR_QUICK2 - Q_INTERFACES(QQmlParserStatus) -#else - Q_INTERFACES(QDeclarativeParserStatus) -#endif - 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) -#ifdef CHARTS_FOR_QUICK2 - Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren) -#else - Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren) -#endif - Q_CLASSINFO("DefaultProperty", "seriesChildren") - -public: - explicit DeclarativeHorizontalPercentBarSeries(QDECLARATIVE_ITEM *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); } - Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - QDECLARATIVE_LIST_PROPERTY<QObject> 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(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element); - -public: - DeclarativeAxes *m_axes; -}; - -QTCOMMERCIALCHART_END_NAMESPACE - -#endif // DECLARATIVEBARSERIES_H diff --git a/plugins/declarative/declarativeboxplotseries.cpp b/plugins/declarative/declarativeboxplotseries.cpp deleted file mode 100644 index 64f31e5d..00000000 --- a/plugins/declarative/declarativeboxplotseries.cpp +++ /dev/null @@ -1,401 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "declarativebarseries.h" -#include "declarativeboxplotseries.h" -#include "qboxset.h" -#include "qvboxplotmodelmapper.h" - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -#ifdef QDOC_QT5 -/*! - \qmltype BoxSet - \instantiates QBoxSet - \inqmlmodule QtCommercial.Chart - - \include doc/src/declarativeboxset.qdocinc -*/ -#else -/*! - \qmlclass BoxSet QBoxSet - - \include ../doc/src/declarativeboxset.qdocinc -*/ -#endif -/*! - \qmlproperty string BoxSet::values - The values on the box-and-whiskers set. -*/ -/*! - \qmlproperty string BoxSet::label - Defines the label of the box-and-whiskers set. -*/ -/*! - \qmlproperty int BoxSet::count - The count of values on the box-and-whiskers set -*/ -/*! - \qmlmethod void BoxSet::at(int index) - Returns the value at \a index position. -*/ -/*! - \qmlmethod void BoxSet::append(qreal value) - Appends new value \a value to the end of set. -*/ -/*! - \qmlmethod void BoxSet::clear() - Sets all values on the set to 0. -*/ -/*! - \qmlmethod void BoxSet::setValue(int index, qreal value) - Sets a new \a value on the \a index position. -*/ -/*! - \qmlsignal BoxSet::onClicked() - This signal is emitted when the user clicks with a mouse on top of box-and-whiskers item. -*/ -/*! - \qmlsignal BoxSet::onHovered(bool status) - The signal is emitted if mouse is hovered on top of box-and-whiskers item. - Parameter \a status is true, if mouse entered on top of the item, and false if mouse left from top of the item. -*/ -/*! - \qmlsignal BoxSet::onPenChanged() - This signal is emitted when the pen of the box-and-whiskers item has changed. -*/ -/*! - \qmlsignal BoxSet::onBrushChanged() - This signal is emitted when the brush of the box-and-whiskers item has changed. -*/ -/*! - \qmlsignal BoxSet::onChangedValues() - This signal is emitted when multiple values have been changed on the box-and-whiskers item. -*/ -/*! - \qmlsignal BoxSet::onChangedValue(int index) - This signal is emitted values the value in the box-and-whiskers item has been modified. - Parameter \a index indicates the position of the modified value. -*/ -/*! - \qmlsignal BoxSet::onCleared() - This signal is emitted when all the values on the set are cleared to 0. -*/ - - -#ifdef QDOC_QT5 -/*! - \qmltype BoxPlotSeries - \instantiates QBoxPlotSeries - \inqmlmodule QtCommercial.Chart - - \include doc/src/declarativeboxplotseries.qdocinc -*/ -#else -/*! - \qmlclass BoxPlotSeries QBoxPlotSeries - - \include ../doc/src/declarativeboxplotseries.qdocinc -*/ -#endif - -/*! - \qmlmethod BoxPlotSeries::append(string label, VariantList values) - Appends a new box-and-whiskers set with \a label and \a values to the series. - */ -/*! - \qmlmethod BoxPlotSeries::append(BoxSet box) - Appends the \a box to the series. -*/ -/*! - \qmlmethod BoxPlotSeries::insert(int index, string label, VariantList values) - Inserts a new box-and-whiskers set with \a label and \a values at the \a index position. -*/ -/*! - \qmlmethod BoxPlotSeries::remove(QBoxSet boxset) - Removes the \a boxset from the series. -*/ -/*! - \qmlmethod BoxPlotSeries::clear() - Removes all boxsets from the series. Deletes removed sets. -*/ -/*! - \qmlsignal BoxPlotSeries::onClicked(BoxSet boxset); - Signal is emitted when the user clicks the \a boxset on the chart. -*/ -/*! - \qmlsignal BoxPlotSeries::onHovered(bool status, BoxSet boxset); - Signal is emitted when there is change in hover \a status over \a boxset. -*/ -/*! - \qmlsignal BoxPlotSeries::onCountChanged(); - Signal is emitted when there is change in count of box-and-whiskers items in the series. -*/ -/*! - \qmlsignal BoxPlotSeries::onBoxsetsAdded() - Signal is emitted when new box-and-whiskers sets are added to the series. - */ -/*! - \qmlsignal BoxPlotSeries::onBoxsetsRemoved() - Signal is emitted when new box-and-whiskers sets are removed from the series. - */ -/*! - \qmlproperty AbstractAxis BoxPlotSeries::axisX - The x axis used for the series. If you leave both axisX and axisXTop undefined, a BarCategoriesAxis is created for - the series. - \sa axisXTop -*/ -/*! - \qmlproperty AbstractAxis BoxPlotSeries::axisY - The y axis used for the series. If you leave both axisY and axisYRight undefined, a ValueAxis is created for - the series. - \sa axisYRight -*/ -/*! - \qmlproperty AbstractAxis BoxPlotSeries::axisXTop - The x axis used for the series, drawn on top of the chart view. Note that you can only provide either axisX or - axisXTop, but not both. - \sa axisX -*/ -/*! - \qmlproperty AbstractAxis BoxPlotSeries::axisYRight - The y axis used for the series, drawn to the right on the chart view. Note that you can only provide either axisY - or axisYRight, but not both. - \sa axisY -*/ -/*! - \qmlproperty bool BoxPlotSeries::boxOutlineVisible - This property configures the visibility of the middle box outline. -*/ -/*! - \qmlproperty qreal BoxPlotSeries::boxWidth - This property configures the width of the box-and-whiskers item. The value signifies the relative - width of the box-and-whiskers item inside its own slot. The value can between 0.0 and 1.0. Negative values - are clamped to 0.0 and values over 1.0 are clamped to 1.0. -*/ -/*! - \qmlproperty Pen BoxPlotSeries::pen - This property configures the pen of the box-and-whiskers items. -*/ -/*! - \qmlproperty Brush BoxPlotSeries::brush - This property configures the brush of the box-and-whiskers items. -*/ -/*! - \qmlproperty int BoxPlotSeries::count - The count of sets in series. -*/ -/*! - \qmlsignal BoxPlotSeries::onBoxOutlineVisibilityChanged() - Signal is emitted when the middle box outline visibility is changed. - */ -/*! - \qmlsignal BoxPlotSeries::onBoxWidthChanged() - Signal is emitted when the width of the box-and-whiskers item is changed. - */ -/*! - \qmlsignal BoxPlotSeries::onPenChanged() - Signal is emitted when the pen for box-and-whiskers items has changed. -*/ -/*! - \qmlsignal BoxPlotSeries::onBrushChanged() - Signal is emitted when the brush for box-and-whiskers items has changed. -*/ -/*! - \qmlsignal BoxPlotSeries::onClicked(BoxSet boxset) - Signal is emitted when the user clicks the \a boxset on the chart. -*/ -/*! - \qmlsignal BoxPlotSeries::onHovered(bool status, BoxSet boxset) - Signal is emitted when there is change in hover \a status over \a boxset. -*/ -/*! - \qmlsignal BoxPlotSeries::onAxisXChanged(AbstractAxis axis) - Signal is emitted when there is change in X axis. -*/ -/*! - \qmlsignal BoxPlotSeries::onAxisYChanged(AbstractAxis axis) - Signal is emitted when there is change in Y axis. -*/ -/*! - \qmlsignal BoxPlotSeries::onAxisXTopChanged(AbstractAxis axis) - Signal is emitted when there is change in top X axis. -*/ -/*! - \qmlsignal BoxPlotSeries::onAxisYRightChanged(AbstractAxis axis) - Signal is emitted when there is change in Y right axis. -*/ - - -DeclarativeBoxSet::DeclarativeBoxSet(const QString label, QObject *parent) - : QBoxSet(label, parent) -{ - connect(this, SIGNAL(valuesChanged()), this, SIGNAL(changedValues())); - connect(this, SIGNAL(valueChanged(int)), this, SIGNAL(changedValue(int))); - connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged())); -} - -QVariantList DeclarativeBoxSet::values() -{ - QVariantList values; - for (int i(0); i < 5; i++) - values.append(QVariant(QBoxSet::at(i))); - return values; -} - -void DeclarativeBoxSet::setValues(QVariantList values) -{ - for (int i(0); i < values.count(); i++) { - if (values.at(i).canConvert(QVariant::Double)) - QBoxSet::append(values[i].toDouble()); - } -} - -QString DeclarativeBoxSet::brushFilename() const -{ - return m_brushFilename; -} - -void DeclarativeBoxSet::setBrushFilename(const QString &brushFilename) -{ - QImage brushImage(brushFilename); - if (QBoxSet::brush().textureImage() != brushImage) { - QBrush brush = QBoxSet::brush(); - brush.setTextureImage(brushImage); - QBoxSet::setBrush(brush); - m_brushFilename = brushFilename; - m_brushImage = brushImage; - emit brushFilenameChanged(brushFilename); - } -} - -void DeclarativeBoxSet::handleBrushChanged() -{ - // If the texture image of the brush has changed along the brush - // the brush file name needs to be cleared. - if (!m_brushFilename.isEmpty() && QBoxSet::brush().textureImage() != m_brushImage) { - m_brushFilename.clear(); - emit brushFilenameChanged(QString("")); - } -} - -// ===================================================== - -DeclarativeBoxPlotSeries::DeclarativeBoxPlotSeries(QDECLARATIVE_ITEM *parent) : - QBoxPlotSeries(parent), - m_axes(new DeclarativeAxes(this)) -{ - connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*))); - connect(this, SIGNAL(hovered(bool, QBoxSet*)), this, SLOT(onHovered(bool, QBoxSet*))); - connect(this, SIGNAL(clicked(QBoxSet*)), this, SLOT(onClicked(QBoxSet*))); - connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged())); -} - -void DeclarativeBoxPlotSeries::classBegin() -{ -} - -void DeclarativeBoxPlotSeries::componentComplete() -{ - foreach (QObject *child, children()) { - if (qobject_cast<DeclarativeBoxSet *>(child)) { - QBoxPlotSeries::append(qobject_cast<DeclarativeBoxSet *>(child)); - } else if (qobject_cast<QVBoxPlotModelMapper *>(child)) { - QVBoxPlotModelMapper *mapper = qobject_cast<QVBoxPlotModelMapper *>(child); - mapper->setSeries(this); - } - } -} - -QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeBoxPlotSeries::seriesChildren() -{ - return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeBoxPlotSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS); -} - -void DeclarativeBoxPlotSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element) -{ - // Empty implementation; the children are parsed in componentComplete instead - Q_UNUSED(list); - Q_UNUSED(element); -} - -DeclarativeBoxSet *DeclarativeBoxPlotSeries::at(int index) -{ - QList<QBoxSet *> setList = boxSets(); - if (index >= 0 && index < setList.count()) - return qobject_cast<DeclarativeBoxSet *>(setList[index]); - - return 0; -} - -DeclarativeBoxSet *DeclarativeBoxPlotSeries::insert(int index, const QString label, QVariantList values) -{ - DeclarativeBoxSet *barset = new DeclarativeBoxSet(label, this); - barset->setValues(values); - if (QBoxPlotSeries::insert(index, barset)) - return barset; - delete barset; - return 0; -} - -void DeclarativeBoxPlotSeries::onHovered(bool status, QBoxSet *boxset) -{ - emit hovered(status, qobject_cast<DeclarativeBoxSet *>(boxset)); -} - -void DeclarativeBoxPlotSeries::onClicked(QBoxSet *boxset) -{ - emit clicked(qobject_cast<DeclarativeBoxSet *>(boxset)); -} - -QString DeclarativeBoxPlotSeries::brushFilename() const -{ - return m_brushFilename; -} - -void DeclarativeBoxPlotSeries::setBrushFilename(const QString &brushFilename) -{ - QImage brushImage(brushFilename); - if (QBoxPlotSeries::brush().textureImage() != brushImage) { - QBrush brush = QBoxPlotSeries::brush(); - brush.setTextureImage(brushImage); - QBoxPlotSeries::setBrush(brush); - m_brushFilename = brushFilename; - m_brushImage = brushImage; - emit brushFilenameChanged(brushFilename); - } -} - -void DeclarativeBoxPlotSeries::handleBrushChanged() -{ - // If the texture image of the brush has changed along the brush - // the brush file name needs to be cleared. - if (!m_brushFilename.isEmpty() && QBoxPlotSeries::brush().textureImage() != m_brushImage) { - m_brushFilename.clear(); - emit brushFilenameChanged(QString("")); - } -} - -#include "moc_declarativeboxplotseries.cpp" - -QTCOMMERCIALCHART_END_NAMESPACE diff --git a/plugins/declarative/declarativeboxplotseries.h b/plugins/declarative/declarativeboxplotseries.h deleted file mode 100644 index 7bbb321a..00000000 --- a/plugins/declarative/declarativeboxplotseries.h +++ /dev/null @@ -1,154 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVEBOXPLOT_H -#define DECLARATIVEBOXPLOT_H - -#include "qboxset.h" -#include "declarativeaxes.h" -#include "qboxplotseries.h" -#ifdef CHARTS_FOR_QUICK2 -#include <QtQuick/QQuickItem> -#include <QtQml/QQmlParserStatus> -#else -#include <QtDeclarative/QDeclarativeItem> -#include <QtDeclarative/QDeclarativeParserStatus> -#endif - -QTCOMMERCIALCHART_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 QDECLARATIVE_PARSER_STATUS -{ - Q_OBJECT -#ifdef CHARTS_FOR_QUICK2 - Q_INTERFACES(QQmlParserStatus) -#else - Q_INTERFACES(QDeclarativeParserStatus) -#endif - 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) -#ifdef CHARTS_FOR_QUICK2 - Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren) -#else - Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren) -#endif - Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 1) - Q_CLASSINFO("DefaultProperty", "seriesChildren") - -public: - explicit DeclarativeBoxPlotSeries(QDECLARATIVE_ITEM *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); } - QDECLARATIVE_LIST_PROPERTY<QObject> 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<QBoxSet *>(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); - Q_REVISION(1) void brushFilenameChanged(const QString &brushFilename); - -public Q_SLOTS: - static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element); - void onHovered(bool status, QBoxSet *boxset); - void onClicked(QBoxSet *boxset); - -private Q_SLOTS: - void handleBrushChanged(); - -public: - DeclarativeAxes *m_axes; - -private: - QString m_brushFilename; - QImage m_brushImage; -}; - -QTCOMMERCIALCHART_END_NAMESPACE - -#endif // DECLARATIVEBOXPLOT_H diff --git a/plugins/declarative/declarativecategoryaxis.cpp b/plugins/declarative/declarativecategoryaxis.cpp deleted file mode 100644 index 49fa0d59..00000000 --- a/plugins/declarative/declarativecategoryaxis.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "declarativecategoryaxis.h" -#include <QDebug> - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -#ifdef QDOC_QT5 -/*! - \qmltype CategoryRange - \inqmlmodule QtCommercial.Chart - - \include doc/src/categoryrange.qdocinc -*/ -#else -/*! - \qmlclass CategoryRange - - \include ../doc/src/categoryrange.qdocinc -*/ -#endif - -DeclarativeCategoryRange::DeclarativeCategoryRange(QObject *parent) : - QObject(parent), - m_endValue(0), - m_label(QString()) -{ -} - -DeclarativeCategoryAxis::DeclarativeCategoryAxis(QObject *parent) : - QCategoryAxis(parent) -{ -} - -void DeclarativeCategoryAxis::classBegin() -{ -} - -void DeclarativeCategoryAxis::componentComplete() -{ - QList<QPair<QString, qreal> > ranges; - foreach (QObject *child, children()) { - if (qobject_cast<DeclarativeCategoryRange *>(child)) { - DeclarativeCategoryRange *range = qobject_cast<DeclarativeCategoryRange *>(child); - ranges.append(QPair<QString, qreal>(range->label(), range->endValue())); - } - } - - // Sort and append the range objects according to end value - qSort(ranges.begin(), ranges.end(), endValueLessThan); - for (int i(0); i < ranges.count(); i++) - append(ranges.at(i).first, ranges.at(i).second); -} - -bool DeclarativeCategoryAxis::endValueLessThan(const QPair<QString, qreal> &value1, const QPair<QString, qreal> &value2) -{ - return value1.second < value2.second; -} - -QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeCategoryAxis::axisChildren() -{ - return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeCategoryAxis::appendAxisChildren LIST_PROPERTY_PARAM_DEFAULTS); -} - -void DeclarativeCategoryAxis::append(const QString &label, qreal categoryEndValue) -{ - QCategoryAxis::append(label, categoryEndValue); -} - -void DeclarativeCategoryAxis::remove(const QString &label) -{ - QCategoryAxis::remove(label); -} - -void DeclarativeCategoryAxis::replace(const QString &oldLabel, const QString &newLabel) -{ - QCategoryAxis::replaceLabel(oldLabel, newLabel); -} - -void DeclarativeCategoryAxis::appendAxisChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element) -{ - // Empty implementation; the children are parsed in componentComplete instead - Q_UNUSED(list) - Q_UNUSED(element) -} - -#include "moc_declarativecategoryaxis.cpp" - -QTCOMMERCIALCHART_END_NAMESPACE diff --git a/plugins/declarative/declarativecategoryaxis.h b/plugins/declarative/declarativecategoryaxis.h deleted file mode 100644 index 999339fd..00000000 --- a/plugins/declarative/declarativecategoryaxis.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVECATEGORYAXIS_H -#define DECLARATIVECATEGORYAXIS_H - -#include "qcategoryaxis.h" -#include "shared_defines.h" - -#ifdef CHARTS_FOR_QUICK2 -#include <QtQml/QQmlListProperty> -#include <QtQml/QQmlParserStatus> -#else -#include <QtDeclarative/QDeclarativeListProperty> -#include <QtDeclarative/QDeclarativeParserStatus> -#endif - -QTCOMMERCIALCHART_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 QDECLARATIVE_PARSER_STATUS -{ - Q_OBJECT -#ifdef CHARTS_FOR_QUICK2 - Q_INTERFACES(QQmlParserStatus) - Q_PROPERTY(QQmlListProperty<QObject> axisChildren READ axisChildren) -#else - Q_INTERFACES(QDeclarativeParserStatus) - Q_PROPERTY(QDeclarativeListProperty<QObject> axisChildren READ axisChildren) -#endif - Q_CLASSINFO("DefaultProperty", "axisChildren") - -public: - explicit DeclarativeCategoryAxis(QObject *parent = 0); - QDECLARATIVE_LIST_PROPERTY<QObject> axisChildren(); - -public: // from QDeclarativeParserStatus - void classBegin(); - void componentComplete(); - -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(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element); - -private: - static bool endValueLessThan(const QPair<QString, qreal> &value1, const QPair<QString, qreal> &value2); -}; - -QTCOMMERCIALCHART_END_NAMESPACE - -#endif // DECLARATIVECATEGORYAXIS_H diff --git a/plugins/declarative/declarativechart.cpp b/plugins/declarative/declarativechart.cpp deleted file mode 100644 index fec441d5..00000000 --- a/plugins/declarative/declarativechart.cpp +++ /dev/null @@ -1,1080 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "declarativechart.h" -#include <QPainter> -#include "declarativelineseries.h" -#include "declarativeareaseries.h" -#include "declarativebarseries.h" -#include "declarativepieseries.h" -#include "declarativesplineseries.h" -#include "declarativeboxplotseries.h" -#include "declarativescatterseries.h" -#include "qbarcategoryaxis.h" -#include "qvalueaxis.h" -#include "qlogvalueaxis.h" -#include "qcategoryaxis.h" -#include "qabstractseries_p.h" -#include "declarativemargins.h" -#include "chartdataset_p.h" -#include "declarativeaxes.h" -#include "qchart_p.h" -#include "qpolarchart.h" - -#ifndef QT_ON_ARM - #include "qdatetimeaxis.h" -#endif - -#ifdef CHARTS_FOR_QUICK2 -#include <QGraphicsSceneMouseEvent> -#include <QGraphicsSceneHoverEvent> -#include <QApplication> -#include <QTimer> -#include <QThread> -#endif - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -#ifdef QDOC_QT5 -/*! - \qmltype ChartView - \instantiates DeclarativeChart - \inqmlmodule QtCommercial.Chart - - \include doc/src/chartview.qdocinc -*/ -#else -/*! - \qmlclass ChartView DeclarativeChart - - \include ../doc/src/chartview.qdocinc -*/ -#endif - -/*! - \qmlproperty Theme ChartView::theme - Theme defines the visual appearance of the chart, including for example colors, fonts, line - widths and chart background. -*/ - -/*! - \qmlproperty Animation ChartView::animationOptions - Animation configuration of the chart. One of ChartView.NoAnimation, ChartView.GridAxisAnimations, - ChartView.SeriesAnimations or ChartView.AllAnimations. -*/ - -/*! - \qmlproperty Font ChartView::titleFont - The title font of the chart. - - See the Qt documentation for more details of Font. -*/ - -/*! - \qmlproperty string ChartView::title - The title of the chart, shown on top of the chart. - \sa ChartView::titleColor -*/ - -/*! - \qmlproperty color ChartView::titleColor - The color of the title text. -*/ - -/*! - \qmlproperty Legend ChartView::legend - The legend of the chart. Legend lists all the series, pie slices and bar sets added on the chart. -*/ - -/*! - \qmlproperty int ChartView::count - The count of series added to the chart. -*/ - -/*! - \qmlproperty color ChartView::backgroundColor - The color of the chart's background. By default background color is defined by chart theme. - \sa ChartView::theme -*/ - -/*! - \qmlproperty real ChartView::backgroundRoundness - The diameter of the rounding cirle at the corners of the chart background. -*/ - -/*! - \qmlproperty color ChartView::plotAreaColor - The color of the background of the chart's plot area. By default plot area background uses chart's - background color. - \sa ChartView::backgroundColor -*/ - -/*! - \qmlproperty bool ChartView::dropShadowEnabled - The chart's border drop shadow. Set to true to enable drop shadow. -*/ - -/*! - \qmlproperty real ChartView::topMargin - Deprecated; use margins instead. -*/ - -/*! - \qmlproperty real ChartView::bottomMargin - Deprecated; use margins instead. -*/ - -/*! - \qmlproperty real ChartView::leftMargin - Deprecated; use margins instead. -*/ - -/*! - \qmlproperty real ChartView::rightMargin - Deprecated; use margins instead. -*/ - -/*! - \qmlproperty Margins ChartView::minimumMargins - Deprecated; use margins instead. - The minimum margins allowed between the outer bounds and the plotArea of the ChartView. Margins - area of ChartView is used for drawing title, axes and legend. Please note that setting the - properties of minimumMargins may be bigger than the defined value, depending on other ChartView - properties that affect it's layout. If you need to know the actual plotting area used at any - given time, you can check ChartView::plotArea instead. -*/ - -/*! - \qmlproperty rect ChartView::plotArea - The area on the ChartView that is used for drawing series. This is the ChartView rect without the - margins. - \sa ChartView::minimumMargins -*/ - -/*! - \qmlproperty Margins ChartView::margins - The minimum margins allowed between the outer bounds and the plotArea of the ChartView. Margins - area of ChartView is used for drawing title, axes and legend. -*/ - -/*! - \qmlproperty bool ChartView::localizeNumbers - \since QtCharts 2.0 - When \c{true}, all generated numbers appearing in various series and axis labels will be - localized using the default QLocale of the application, which defaults to the system locale. - When \c{false}, the "C" locale is always used. - Defaults to \c{false}. - - \sa locale -*/ - -/*! - \qmlproperty locale ChartView::locale - \since QtCharts 2.0 - Sets the locale used to format various chart labels when localizeNumbers is \c{true}. - This also determines the locale used to format DateTimeAxis labels regardless of - localizeNumbers property. - Defaults to application default locale at the time the chart is constructed. - - \sa localizeNumbers -*/ - -/*! - \qmlmethod AbstractSeries ChartView::series(int index) - Returns the series with \a index on the chart. This allows you to loop through the series of a chart together with - the count property of the chart. -*/ - -/*! - \qmlmethod AbstractSeries ChartView::series(string name) - Returns the first series on the chart with \a name. If there is no series with that name, returns null. -*/ - -/*! - \qmlmethod AbstractSeries ChartView::createSeries(SeriesType type, string name, AbstractAxis axisX, AbstractAxis axisY) - Creates a series object of \a type to the chart with name \a name, optional axis \a axisX and - optional axis \a axisY. For example: - \code - // lineSeries is a LineSeries object that has already been added to the ChartView; re-use it's axes - var myAxisX = chartView.axisX(lineSeries); - var myAxisY = chartView.axisY(lineSeries); - var scatter = chartView.createSeries(ChartView.SeriesTypeScatter, "scatter series", myAxisX, myAxisY); - \endcode -*/ - -/*! - \qmlmethod ChartView::removeSeries(AbstractSeries series) - Removes the \a series from the chart. The series object is also destroyed. -*/ - -/*! - \qmlmethod ChartView::removeAllSeries() - Removes all series from the chart. All the series objects are also destroyed. -*/ - -/*! - \qmlmethod Axis ChartView::axisX(AbstractSeries series) - The x-axis of the series. -*/ - -/*! - \qmlmethod Axis ChartView::axisY(AbstractSeries series) - The y-axis of the series. -*/ - -/*! - \qmlmethod ChartView::zoomY(real factor) - Zooms in by \a factor on the center of the chart. -*/ - -/*! - \qmlmethod ChartView::scrollLeft(real pixels) - Scrolls to left by \a pixels. This is a convenience function that suits for example for key navigation. -*/ - -/*! - \qmlmethod ChartView::scrollRight(real pixels) - Scrolls to right by \a pixels. This is a convenience function that suits for example for key navigation. -*/ - -/*! - \qmlmethod ChartView::scrollUp(real pixels) - Scrolls up by \a pixels. This is a convenience function that suits for example for key navigation. -*/ - -/*! - \qmlmethod ChartView::scrollDown(real pixels) - Scrolls down by \a pixels. This is a convenience function that suits for example for key navigation. -*/ - -/*! - \qmlsignal ChartView::onPlotAreaChanged(rect plotArea) - The plot area of the chart has changed. This may happen for example, if you modify minimumMargins - or if you resize the chart, or if you modify font size related properties of the legend or chart - title. -*/ - -/*! - \qmlsignal ChartView::seriesAdded(AbstractSeries series) - The \a series has been added to the chart. -*/ - -/*! - \qmlsignal ChartView::seriesRemoved(AbstractSeries series) - The \a series has been removed from the chart. Please note that \a series is no longer a valid - object after the signal handler has completed. -*/ - -DeclarativeChart::DeclarativeChart(QDECLARATIVE_ITEM *parent) - : QDECLARATIVE_PAINTED_ITEM(parent) -{ - initChart(QChart::ChartTypeCartesian); -} - -DeclarativeChart::DeclarativeChart(QChart::ChartType type, QDECLARATIVE_ITEM *parent) - : QDECLARATIVE_PAINTED_ITEM(parent) -{ - initChart(type); -} - -void DeclarativeChart::initChart(QChart::ChartType type) -{ -#ifdef CHARTS_FOR_QUICK2 - m_currentSceneImage = 0; - m_guiThreadId = QThread::currentThreadId(); - m_paintThreadId = 0; - m_updatePending = false; - - if (type == QChart::ChartTypePolar) - m_chart = new QPolarChart(); - else - m_chart = new QChart(); - - m_scene = new QGraphicsScene(this); - m_scene->addItem(m_chart); - - setAntialiasing(QQuickItem::antialiasing()); - connect(m_scene, SIGNAL(changed(QList<QRectF>)), this, SLOT(sceneChanged(QList<QRectF>))); - connect(this, SIGNAL(antialiasingChanged(bool)), this, SLOT(handleAntialiasingChanged(bool))); - - setAcceptedMouseButtons(Qt::AllButtons); - setAcceptHoverEvents(true); -#else - if (type == QChart::ChartTypePolar) - m_chart = new QPolarChart(this); - else - m_chart = new QChart(this); - - setFlag(QGraphicsItem::ItemHasNoContents, false); -#endif - - m_margins = new DeclarativeMargins(this); - m_margins->setTop(m_chart->margins().top()); - m_margins->setLeft(m_chart->margins().left()); - m_margins->setRight(m_chart->margins().right()); - m_margins->setBottom(m_chart->margins().bottom()); - connect(m_margins, SIGNAL(topChanged(int,int,int,int)), this, SLOT(changeMinimumMargins(int,int,int,int))); - connect(m_margins, SIGNAL(bottomChanged(int,int,int,int)), this, SLOT(changeMinimumMargins(int,int,int,int))); - connect(m_margins, SIGNAL(leftChanged(int,int,int,int)), this, SLOT(changeMinimumMargins(int,int,int,int))); - connect(m_margins, SIGNAL(rightChanged(int,int,int,int)), this, SLOT(changeMinimumMargins(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*))); -} - -void DeclarativeChart::handleSeriesAdded(QAbstractSeries *series) -{ - emit seriesAdded(series); -} - -void DeclarativeChart::changeMinimumMargins(int top, int bottom, int left, int right) -{ - m_chart->setMargins(QMargins(left, top, right, bottom)); - emit minimumMarginsChanged(); - emit plotAreaChanged(m_chart->plotArea()); -} - -DeclarativeChart::~DeclarativeChart() -{ - delete m_chart; -#ifdef CHARTS_FOR_QUICK2 - m_sceneImageLock.lock(); - delete m_currentSceneImage; - m_currentSceneImage = 0; - m_sceneImageLock.unlock(); -#endif -} - -void DeclarativeChart::childEvent(QChildEvent *event) -{ - if (event->type() == QEvent::ChildAdded) { - if (qobject_cast<QAbstractSeries *>(event->child())) { - m_chart->addSeries(qobject_cast<QAbstractSeries *>(event->child())); - } - } -} - -void DeclarativeChart::componentComplete() -{ - foreach (QObject *child, children()) { - if (qobject_cast<QAbstractSeries *>(child)) { - // Add series to the chart - QAbstractSeries *series = qobject_cast<QAbstractSeries *>(child); - m_chart->addSeries(series); - - // Connect to axis changed signals (unless this is a pie series) - if (!qobject_cast<DeclarativePieSeries *>(series)) { - connect(series, SIGNAL(axisXChanged(QAbstractAxis*)), this, SLOT(handleAxisXSet(QAbstractAxis*))); - connect(series, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SLOT(handleAxisXTopSet(QAbstractAxis*))); - connect(series, SIGNAL(axisYChanged(QAbstractAxis*)), this, SLOT(handleAxisYSet(QAbstractAxis*))); - connect(series, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SLOT(handleAxisYRightSet(QAbstractAxis*))); - } - - initializeAxes(series); - } - } - - QDECLARATIVE_ITEM::componentComplete(); -} - -void DeclarativeChart::handleAxisXSet(QAbstractAxis *axis) -{ - QAbstractSeries *s = qobject_cast<QAbstractSeries *>(sender()); - if (axis && s) { - if (!m_chart->axes(Qt::Horizontal).contains(axis)) - m_chart->setAxisX(axis, s); - if (!s->attachedAxes().contains(axis)) - s->attachAxis(axis); - } else { - qWarning() << "Trying to set axisX to null."; - } -} - -void DeclarativeChart::handleAxisXTopSet(QAbstractAxis *axis) -{ - QAbstractSeries *s = qobject_cast<QAbstractSeries *>(sender()); - if (axis && s) { - if (!m_chart->axes(Qt::Horizontal).contains(axis)) { - QList<QAbstractAxis *> oldAxes = m_chart->axes(Qt::Horizontal, s); - foreach (QAbstractAxis* a, oldAxes) { - m_chart->removeAxis(a); - delete a; - } - m_chart->addAxis(axis, Qt::AlignTop); - } - if (!s->attachedAxes().contains(axis)) - s->attachAxis(axis); - } else { - qWarning() << "Trying to set axisXTop to null."; - } -} - -void DeclarativeChart::handleAxisYSet(QAbstractAxis *axis) -{ - QAbstractSeries *s = qobject_cast<QAbstractSeries *>(sender()); - if (axis && s) { - if (!m_chart->axes(Qt::Vertical).contains(axis)) - m_chart->setAxisY(axis, s); - if (!s->attachedAxes().contains(axis)) - s->attachAxis(axis); - } else { - qWarning() << "Trying to set axisY to null."; - } -} - -void DeclarativeChart::handleAxisYRightSet(QAbstractAxis *axis) -{ - QAbstractSeries *s = qobject_cast<QAbstractSeries *>(sender()); - if (axis && s) { - if (!m_chart->axes(Qt::Vertical).contains(axis)) { - QList<QAbstractAxis *> oldAxes = m_chart->axes((Qt::Vertical), s); - foreach (QAbstractAxis* a, oldAxes) { - m_chart->removeAxis(a); - delete a; - } - m_chart->addAxis(axis, Qt::AlignRight); - } - if (!s->attachedAxes().contains(axis)) - s->attachAxis(axis); - } else { - qWarning() << "Trying to set axisYRight to null."; - } -} - -void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) -{ - if (newGeometry.isValid()) { - if (newGeometry.width() > 0 && newGeometry.height() > 0) { - m_chart->resize(newGeometry.width(), newGeometry.height()); - } - } - QDECLARATIVE_ITEM::geometryChanged(newGeometry, oldGeometry); - - // It would be better to trigger the plotAreaChanged signal from QChart::plotAreaChanged or - // similar. Since that kind of a signal is not clearly needed in the C++ API the work-around is - // to implement it here for the QML API purposes. - emit plotAreaChanged(m_chart->plotArea()); -} - -#ifdef CHARTS_FOR_QUICK2 -void DeclarativeChart::sceneChanged(QList<QRectF> region) -{ - Q_UNUSED(region); - - if (m_guiThreadId == m_paintThreadId) { - // Rendering in gui thread, no need for shenannigans, just update - update(); - } else { - // Multi-threaded rendering, need to ensure scene is actually rendered in gui thread - if (!m_updatePending) { - m_updatePending = true; - // Do async render to avoid some unnecessary renders. - QTimer::singleShot(0, this, SLOT(renderScene())); - } - } -} - -void DeclarativeChart::renderScene() -{ - m_updatePending = false; - m_sceneImageLock.lock(); - delete m_currentSceneImage; - m_currentSceneImage = new QImage(m_chart->size().toSize(), QImage::Format_ARGB32); - m_currentSceneImage->fill(Qt::transparent); - QPainter painter(m_currentSceneImage); - if (antialiasing()) - painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform); - QRect renderRect(QPoint(0, 0), m_chart->size().toSize()); - m_scene->render(&painter, renderRect, renderRect); - m_sceneImageLock.unlock(); - - update(); -} - -void DeclarativeChart::paint(QPainter *painter) -{ - if (!m_paintThreadId) { - m_paintThreadId = QThread::currentThreadId(); - if (m_guiThreadId == m_paintThreadId) { - // No need for scene image in single threaded rendering, so delete - // the one that got made by default before the rendering type was - // detected. - delete m_currentSceneImage; - m_currentSceneImage = 0; - } - } - - if (m_guiThreadId == m_paintThreadId) { - QRectF renderRect(QPointF(0, 0), m_chart->size()); - m_scene->render(painter, renderRect, renderRect); - } else { - m_sceneImageLock.lock(); - if (m_currentSceneImage) { - QRect imageRect(QPoint(0, 0), m_currentSceneImage->size()); - QRect itemRect(QPoint(0, 0), QSize(width(), height())); - painter->drawImage(itemRect, *m_currentSceneImage, imageRect); - } - m_sceneImageLock.unlock(); - } -} - -void DeclarativeChart::mousePressEvent(QMouseEvent *event) -{ - m_mousePressScenePoint = event->pos(); - m_mousePressScreenPoint = event->globalPos(); - m_lastMouseMoveScenePoint = m_mousePressScenePoint; - m_lastMouseMoveScreenPoint = m_mousePressScreenPoint; - m_mousePressButton = event->button(); - m_mousePressButtons = event->buttons(); - - QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMousePress); - mouseEvent.setWidget(0); - mouseEvent.setButtonDownScenePos(m_mousePressButton, m_mousePressScenePoint); - mouseEvent.setButtonDownScreenPos(m_mousePressButton, m_mousePressScreenPoint); - mouseEvent.setScenePos(m_mousePressScenePoint); - mouseEvent.setScreenPos(m_mousePressScreenPoint); - mouseEvent.setLastScenePos(m_lastMouseMoveScenePoint); - mouseEvent.setLastScreenPos(m_lastMouseMoveScreenPoint); - mouseEvent.setButtons(m_mousePressButtons); - mouseEvent.setButton(m_mousePressButton); - mouseEvent.setModifiers(event->modifiers()); - mouseEvent.setAccepted(false); - - QApplication::sendEvent(m_scene, &mouseEvent); -} - -void DeclarativeChart::mouseReleaseEvent(QMouseEvent *event) -{ - QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseRelease); - mouseEvent.setWidget(0); - mouseEvent.setButtonDownScenePos(m_mousePressButton, m_mousePressScenePoint); - mouseEvent.setButtonDownScreenPos(m_mousePressButton, m_mousePressScreenPoint); - mouseEvent.setScenePos(event->pos()); - mouseEvent.setScreenPos(event->globalPos()); - mouseEvent.setLastScenePos(m_lastMouseMoveScenePoint); - mouseEvent.setLastScreenPos(m_lastMouseMoveScreenPoint); - mouseEvent.setButtons(event->buttons()); - mouseEvent.setButton(event->button()); - mouseEvent.setModifiers(event->modifiers()); - mouseEvent.setAccepted(false); - - QApplication::sendEvent(m_scene, &mouseEvent); - - m_mousePressButtons = event->buttons(); - m_mousePressButton = Qt::NoButton; -} - -void DeclarativeChart::hoverMoveEvent(QHoverEvent *event) -{ - // Convert hover move to mouse move, since we don't seem to get actual mouse move events. - // QGraphicsScene generates hover events from mouse move events, so we don't need - // to pass hover events there. - QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseMove); - mouseEvent.setWidget(0); - mouseEvent.setButtonDownScenePos(m_mousePressButton, m_mousePressScenePoint); - mouseEvent.setButtonDownScreenPos(m_mousePressButton, m_mousePressScreenPoint); - mouseEvent.setScenePos(event->pos()); - // Hover events do not have global pos in them, and the screen position doesn't seem to - // matter anyway in this use case, so just pass event pos instead of trying to - // calculate the real screen position. - mouseEvent.setScreenPos(event->pos()); - mouseEvent.setLastScenePos(m_lastMouseMoveScenePoint); - mouseEvent.setLastScreenPos(m_lastMouseMoveScreenPoint); - mouseEvent.setButtons(m_mousePressButtons); - mouseEvent.setButton(m_mousePressButton); - mouseEvent.setModifiers(event->modifiers()); - m_lastMouseMoveScenePoint = mouseEvent.scenePos(); - m_lastMouseMoveScreenPoint = mouseEvent.screenPos(); - mouseEvent.setAccepted(false); - - QApplication::sendEvent(m_scene, &mouseEvent); -} - -void DeclarativeChart::handleAntialiasingChanged(bool enable) -{ - setAntialiasing(enable); -} -#endif - -void DeclarativeChart::setTheme(DeclarativeChart::Theme theme) -{ - QChart::ChartTheme chartTheme = (QChart::ChartTheme) theme; - if (chartTheme != m_chart->theme()) - m_chart->setTheme(chartTheme); -} - -DeclarativeChart::Theme DeclarativeChart::theme() -{ - return (DeclarativeChart::Theme) m_chart->theme(); -} - -void DeclarativeChart::setAnimationOptions(DeclarativeChart::Animation animations) -{ - QChart::AnimationOption animationOptions = (QChart::AnimationOption) animations; - if (animationOptions != m_chart->animationOptions()) - m_chart->setAnimationOptions(animationOptions); -} - -DeclarativeChart::Animation DeclarativeChart::animationOptions() -{ - if (m_chart->animationOptions().testFlag(QChart::AllAnimations)) - return DeclarativeChart::AllAnimations; - else if (m_chart->animationOptions().testFlag(QChart::GridAxisAnimations)) - return DeclarativeChart::GridAxisAnimations; - else if (m_chart->animationOptions().testFlag(QChart::SeriesAnimations)) - return DeclarativeChart::SeriesAnimations; - else - return DeclarativeChart::NoAnimation; -} - -void DeclarativeChart::setTitle(QString title) -{ - if (title != m_chart->title()) - m_chart->setTitle(title); -} -QString DeclarativeChart::title() -{ - return m_chart->title(); -} - -QAbstractAxis *DeclarativeChart::axisX(QAbstractSeries *series) -{ - QList<QAbstractAxis *> axes = m_chart->axes(Qt::Horizontal, series); - if (axes.count()) - return axes[0]; - return 0; -} - -QAbstractAxis *DeclarativeChart::axisY(QAbstractSeries *series) -{ - QList<QAbstractAxis *> axes = m_chart->axes(Qt::Vertical, series); - if (axes.count()) - return axes[0]; - return 0; -} - -QLegend *DeclarativeChart::legend() -{ - return m_chart->legend(); -} - -void DeclarativeChart::setTitleColor(QColor color) -{ - QBrush b = m_chart->titleBrush(); - if (color != b.color()) { - b.setColor(color); - m_chart->setTitleBrush(b); - emit titleColorChanged(color); - } -} - -QFont DeclarativeChart::titleFont() const -{ - return m_chart->titleFont(); -} - -void DeclarativeChart::setTitleFont(const QFont &font) -{ - m_chart->setTitleFont(font); -} - -QColor DeclarativeChart::titleColor() -{ - return m_chart->titleBrush().color(); -} - -void DeclarativeChart::setBackgroundColor(QColor color) -{ - QBrush b = m_chart->backgroundBrush(); - if (b.style() != Qt::SolidPattern || color != b.color()) { - b.setStyle(Qt::SolidPattern); - b.setColor(color); - m_chart->setBackgroundBrush(b); - emit backgroundColorChanged(); - } -} - -QColor DeclarativeChart::backgroundColor() -{ - return m_chart->backgroundBrush().color(); -} - -void QtCommercialChart::DeclarativeChart::setPlotAreaColor(QColor color) -{ - QBrush b = m_chart->plotAreaBackgroundBrush(); - if (b.style() != Qt::SolidPattern || color != b.color()) { - b.setStyle(Qt::SolidPattern); - b.setColor(color); - m_chart->setPlotAreaBackgroundBrush(b); - m_chart->setPlotAreaBackgroundVisible(true); - emit plotAreaColorChanged(); - } -} - -QColor QtCommercialChart::DeclarativeChart::plotAreaColor() -{ - return m_chart->plotAreaBackgroundBrush().color(); -} - -void DeclarativeChart::setLocalizeNumbers(bool localize) -{ - if (m_chart->localizeNumbers() != localize) { - m_chart->setLocalizeNumbers(localize); - emit localizeNumbersChanged(); - } -} - -bool DeclarativeChart::localizeNumbers() const -{ - return m_chart->localizeNumbers(); -} - -void QtCommercialChart::DeclarativeChart::setLocale(const QLocale &locale) -{ - if (m_chart->locale() != locale) { - m_chart->setLocale(locale); - emit localeChanged(); - } -} - -QLocale QtCommercialChart::DeclarativeChart::locale() const -{ - return m_chart->locale(); -} - -int DeclarativeChart::count() -{ - return m_chart->series().count(); -} - -void DeclarativeChart::setDropShadowEnabled(bool enabled) -{ - if (enabled != m_chart->isDropShadowEnabled()) { - m_chart->setDropShadowEnabled(enabled); - dropShadowEnabledChanged(enabled); - } -} - -bool DeclarativeChart::dropShadowEnabled() -{ - return m_chart->isDropShadowEnabled(); -} - -qreal DeclarativeChart::backgroundRoundness() const -{ - return m_chart->backgroundRoundness(); -} - -void DeclarativeChart::setBackgroundRoundness(qreal diameter) -{ - if (m_chart->backgroundRoundness() != diameter) { - m_chart->setBackgroundRoundness(diameter); - emit backgroundRoundnessChanged(diameter); - } -} - -qreal DeclarativeChart::topMargin() -{ - qWarning() << "ChartView.topMargin is deprecated. Use margins instead."; - return m_chart->margins().top(); -} - -qreal DeclarativeChart::bottomMargin() -{ - qWarning() << "ChartView.bottomMargin is deprecated. Use margins instead."; - return m_chart->margins().bottom(); -} - -qreal DeclarativeChart::leftMargin() -{ - qWarning() << "ChartView.leftMargin is deprecated. Use margins instead."; - return m_chart->margins().left(); -} - -qreal DeclarativeChart::rightMargin() -{ - qWarning() << "ChartView.rightMargin is deprecated. Use margins instead."; - return m_chart->margins().right(); -} - -void DeclarativeChart::zoom(qreal factor) -{ - m_chart->zoom(factor); -} - -void DeclarativeChart::scrollLeft(qreal pixels) -{ - m_chart->scroll(-pixels, 0); -} - -void DeclarativeChart::scrollRight(qreal pixels) -{ - m_chart->scroll(pixels, 0); -} - -void DeclarativeChart::scrollUp(qreal pixels) -{ - m_chart->scroll(0, pixels); -} - -void DeclarativeChart::scrollDown(qreal pixels) -{ - m_chart->scroll(0, -pixels); -} - -QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> DeclarativeChart::axes() -{ - return QDECLARATIVE_LIST_PROPERTY<QAbstractAxis>(this, 0, - &DeclarativeChart::axesAppendFunc, - &DeclarativeChart::axesCountFunc, -#ifdef CHARTS_FOR_QUICK2 - &DeclarativeChart::axesAtFunc, - &DeclarativeChart::axesClearFunc); -#else - &DeclarativeChart::axesAtFunc); -#endif -} - -void DeclarativeChart::axesAppendFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list, QAbstractAxis *element) -{ - // Empty implementation - Q_UNUSED(list); - Q_UNUSED(element); -} - -int DeclarativeChart::axesCountFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list) -{ - if (qobject_cast<DeclarativeChart *>(list->object)) { - DeclarativeChart *chart = qobject_cast<DeclarativeChart *>(list->object); - return chart->m_chart->axes(Qt::Horizontal | Qt::Vertical).count(); - } - return 0; -} - -QAbstractAxis *DeclarativeChart::axesAtFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list, int index) -{ - if (qobject_cast<DeclarativeChart *>(list->object)) { - DeclarativeChart *chart = qobject_cast<DeclarativeChart *>(list->object); - QList<QAbstractAxis *> axes = chart->m_chart->axes(Qt::Horizontal | Qt::Vertical, chart->m_chart->series()[0]); - return axes.at(index); - } - return 0; -} - -void DeclarativeChart::axesClearFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list) -{ - // Empty implementation - Q_UNUSED(list); -} - - -QAbstractSeries *DeclarativeChart::series(int index) -{ - if (index < m_chart->series().count()) { - return m_chart->series().at(index); - } - return 0; -} - -QAbstractSeries *DeclarativeChart::series(QString seriesName) -{ - foreach (QAbstractSeries *series, m_chart->series()) { - if (series->name() == seriesName) - return series; - } - return 0; -} - -QAbstractSeries *DeclarativeChart::createSeries(int type, QString name, QAbstractAxis *axisX, QAbstractAxis *axisY) -{ - QAbstractSeries *series = 0; - - switch (type) { - case DeclarativeChart::SeriesTypeLine: - series = new DeclarativeLineSeries(); - break; - case DeclarativeChart::SeriesTypeArea: { - DeclarativeAreaSeries *area = new DeclarativeAreaSeries(); - area->setUpperSeries(new DeclarativeLineSeries()); - series = area; - break; - } - case DeclarativeChart::SeriesTypeStackedBar: - series = new DeclarativeStackedBarSeries(); - break; - case DeclarativeChart::SeriesTypePercentBar: - series = new DeclarativePercentBarSeries(); - break; - case DeclarativeChart::SeriesTypeBar: - series = new DeclarativeBarSeries(); - break; - case DeclarativeChart::SeriesTypeHorizontalBar: - series = new DeclarativeHorizontalBarSeries(); - break; - case DeclarativeChart::SeriesTypeHorizontalPercentBar: - series = new DeclarativeHorizontalPercentBarSeries(); - break; - case DeclarativeChart::SeriesTypeHorizontalStackedBar: - series = new DeclarativeHorizontalStackedBarSeries(); - break; - case DeclarativeChart::SeriesTypeBoxPlot: - series = new DeclarativeBoxPlotSeries(); - break; - case DeclarativeChart::SeriesTypePie: - series = new DeclarativePieSeries(); - break; - case DeclarativeChart::SeriesTypeScatter: - series = new DeclarativeScatterSeries(); - break; - case DeclarativeChart::SeriesTypeSpline: - series = new DeclarativeSplineSeries(); - break; - default: - qWarning() << "Illegal series type"; - } - - if (series) { - // Connect to axis changed signals (unless this is a pie series) - if (!qobject_cast<DeclarativePieSeries *>(series)) { - connect(series, SIGNAL(axisXChanged(QAbstractAxis*)), this, SLOT(handleAxisXSet(QAbstractAxis*))); - connect(series, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SLOT(handleAxisXSet(QAbstractAxis*))); - connect(series, SIGNAL(axisYChanged(QAbstractAxis*)), this, SLOT(handleAxisYSet(QAbstractAxis*))); - connect(series, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SLOT(handleAxisYRightSet(QAbstractAxis*))); - } - - series->setName(name); - m_chart->addSeries(series); - - if (axisX) - setAxisX(axisX, series); - if (axisY) - setAxisY(axisY, series); - - if (series->attachedAxes().count() < 2) - initializeAxes(series); - } - - return series; -} - -void DeclarativeChart::removeSeries(QAbstractSeries *series) -{ - if (series) - m_chart->removeSeries(series); - else - qWarning("removeSeries: cannot remove null"); -} - -void DeclarativeChart::setAxisX(QAbstractAxis *axis, QAbstractSeries *series) -{ - if (axis) - m_chart->setAxisX(axis, series); -} - -void DeclarativeChart::setAxisY(QAbstractAxis *axis, QAbstractSeries *series) -{ - if (axis) - m_chart->setAxisY(axis, series); -} - -void DeclarativeChart::createDefaultAxes() -{ - qWarning() << "ChartView.createDefaultAxes() is deprecated. Axes are created automatically."; -} - -QAbstractAxis *DeclarativeChart::defaultAxis(Qt::Orientation orientation, QAbstractSeries *series) -{ - if (!series) { - qWarning() << "No axis type defined for null series"; - return 0; - } - - foreach (QAbstractAxis *existingAxis, m_chart->axes(orientation)) { - if (existingAxis->type() == series->d_ptr->defaultAxisType(orientation)) - return existingAxis; - } - - switch (series->d_ptr->defaultAxisType(orientation)) { - case QAbstractAxis::AxisTypeValue: - return new QValueAxis(this); - case QAbstractAxis::AxisTypeBarCategory: - return new QBarCategoryAxis(this); - case QAbstractAxis::AxisTypeCategory: - return new QCategoryAxis(this); -#ifndef QT_ON_ARM - case QAbstractAxis::AxisTypeDateTime: - return new QDateTimeAxis(this); -#endif - case QAbstractAxis::AxisTypeLogValue: - return new QLogValueAxis(this); - default: - // assume AxisTypeNoAxis - return 0; - } -} - -void DeclarativeChart::initializeAxes(QAbstractSeries *series) -{ - if (qobject_cast<DeclarativeLineSeries *>(series)) - doInitializeAxes(series, qobject_cast<DeclarativeLineSeries *>(series)->m_axes); - else if (qobject_cast<DeclarativeScatterSeries *>(series)) - doInitializeAxes(series, qobject_cast<DeclarativeScatterSeries *>(series)->m_axes); - else if (qobject_cast<DeclarativeSplineSeries *>(series)) - doInitializeAxes(series, qobject_cast<DeclarativeSplineSeries *>(series)->m_axes); - else if (qobject_cast<DeclarativeAreaSeries *>(series)) - doInitializeAxes(series, qobject_cast<DeclarativeAreaSeries *>(series)->m_axes); - else if (qobject_cast<DeclarativeBarSeries *>(series)) - doInitializeAxes(series, qobject_cast<DeclarativeBarSeries *>(series)->m_axes); - else if (qobject_cast<DeclarativeStackedBarSeries *>(series)) - doInitializeAxes(series, qobject_cast<DeclarativeStackedBarSeries *>(series)->m_axes); - else if (qobject_cast<DeclarativePercentBarSeries *>(series)) - doInitializeAxes(series, qobject_cast<DeclarativePercentBarSeries *>(series)->m_axes); - else if (qobject_cast<DeclarativeHorizontalBarSeries *>(series)) - doInitializeAxes(series, qobject_cast<DeclarativeHorizontalBarSeries *>(series)->m_axes); - else if (qobject_cast<DeclarativeHorizontalStackedBarSeries *>(series)) - doInitializeAxes(series, qobject_cast<DeclarativeHorizontalStackedBarSeries *>(series)->m_axes); - else if (qobject_cast<DeclarativeHorizontalPercentBarSeries *>(series)) - doInitializeAxes(series, qobject_cast<DeclarativeHorizontalPercentBarSeries *>(series)->m_axes); - else if (qobject_cast<DeclarativeBoxPlotSeries *>(series)) - doInitializeAxes(series, qobject_cast<DeclarativeBoxPlotSeries *>(series)->m_axes); - // else: do nothing -} - -void DeclarativeChart::doInitializeAxes(QAbstractSeries *series, DeclarativeAxes *axes) -{ - // Initialize axis X - if (axes->axisX()) - axes->emitAxisXChanged(); - else if (axes->axisXTop()) - axes->emitAxisXTopChanged(); - else - axes->setAxisX(defaultAxis(Qt::Horizontal, series)); - - // Initialize axis Y - if (axes->axisY()) - axes->emitAxisYChanged(); - else if (axes->axisYRight()) - axes->emitAxisYRightChanged(); - else - axes->setAxisY(defaultAxis(Qt::Vertical, series)); -} - -#include "moc_declarativechart.cpp" - -QTCOMMERCIALCHART_END_NAMESPACE diff --git a/plugins/declarative/declarativechart.h b/plugins/declarative/declarativechart.h deleted file mode 100644 index a1b40d80..00000000 --- a/plugins/declarative/declarativechart.h +++ /dev/null @@ -1,245 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVECHART_H -#define DECLARATIVECHART_H - -#include <QtCore/QtGlobal> -#include "shared_defines.h" - -#ifdef CHARTS_FOR_QUICK2 -#include <QtQuick/QQuickItem> -#include <QtQuick/QQuickPaintedItem> -#include <QtWidgets/QGraphicsScene> -#include <QtCore/QMutex> -#else -#include <QtDeclarative/QDeclarativeItem> -#endif - -#include "qchart.h" -#include <QtCore/QLocale> - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -class DeclarativeMargins; -class Domain; -class DeclarativeAxes; - -class DeclarativeChart : public QDECLARATIVE_PAINTED_ITEM -{ - Q_OBJECT - Q_PROPERTY(Theme theme READ theme WRITE setTheme) - Q_PROPERTY(Animation animationOptions READ animationOptions WRITE setAnimationOptions) - 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(qreal topMargin READ topMargin) - Q_PROPERTY(qreal bottomMargin READ bottomMargin) - Q_PROPERTY(qreal leftMargin READ leftMargin) - Q_PROPERTY(qreal rightMargin READ rightMargin) - Q_PROPERTY(DeclarativeMargins *minimumMargins READ minimumMargins NOTIFY minimumMarginsChanged REVISION 1) - 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) -#ifdef CHARTS_FOR_QUICK2 - Q_PROPERTY(QQmlListProperty<QAbstractAxis> axes READ axes REVISION 2) -#else - Q_PROPERTY(QDeclarativeListProperty<QAbstractAxis> axes READ axes REVISION 2) -#endif - 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, - SeriesTypeBoxPlot, - SeriesTypePie, - SeriesTypeScatter, - SeriesTypeSpline, - SeriesTypeHorizontalBar, - SeriesTypeHorizontalStackedBar, - SeriesTypeHorizontalPercentBar - }; - -public: - DeclarativeChart(QDECLARATIVE_ITEM *parent = 0); - ~DeclarativeChart(); - -public: // From parent classes - void childEvent(QChildEvent *event); - void componentComplete(); - void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); -#ifdef CHARTS_FOR_QUICK2 - void paint(QPainter *painter); -protected: - void mousePressEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void hoverMoveEvent(QHoverEvent *event); -private Q_SLOTS: - void handleAntialiasingChanged(bool enable); - void sceneChanged(QList<QRectF> region); - void renderScene(); -#endif - -public: - void setTheme(DeclarativeChart::Theme theme); - DeclarativeChart::Theme theme(); - void setAnimationOptions(DeclarativeChart::Animation animations); - DeclarativeChart::Animation animationOptions(); - 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(); - Q_REVISION(3) void setPlotAreaColor(QColor color); - Q_REVISION(3) QColor plotAreaColor(); - Q_REVISION(4) void setLocalizeNumbers(bool localize); - Q_REVISION(4) bool localizeNumbers() const; - Q_REVISION(4) void setLocale(const QLocale &locale); - Q_REVISION(4) QLocale locale() const; - - int count(); - void setDropShadowEnabled(bool enabled); - bool dropShadowEnabled(); - Q_REVISION(3) qreal backgroundRoundness() const; - Q_REVISION(3) void setBackgroundRoundness(qreal diameter); - - // Margins & plotArea - qreal topMargin(); - qreal bottomMargin(); - qreal leftMargin(); - qreal rightMargin(); - DeclarativeMargins *minimumMargins() { return m_margins; } - Q_REVISION(2) 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); - QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> axes(); - static void axesAppendFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list, QAbstractAxis *element); - static int axesCountFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list); - static QAbstractAxis *axesAtFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list, int index); - static void axesClearFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *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 void createDefaultAxes(); - Q_INVOKABLE QAbstractAxis *axisX(QAbstractSeries *series = 0); - Q_INVOKABLE QAbstractAxis *axisY(QAbstractSeries *series = 0); - Q_INVOKABLE void zoom(qreal factor); - 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_SIGNALS: - void axisLabelsChanged(); - void titleColorChanged(QColor color); - void backgroundColorChanged(); - void dropShadowEnabledChanged(bool enabled); - void minimumMarginsChanged(); - 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(); - -private Q_SLOTS: - void changeMinimumMargins(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); - -protected: - explicit DeclarativeChart(QChart::ChartType type, QDECLARATIVE_ITEM *parent); - -private: - void initChart(QChart::ChartType type); - // 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; -#ifdef CHARTS_FOR_QUICK2 - QGraphicsScene *m_scene; - QPointF m_mousePressScenePoint; - QPoint m_mousePressScreenPoint; - QPointF m_lastMouseMoveScenePoint; - QPoint m_lastMouseMoveScreenPoint; - Qt::MouseButton m_mousePressButton; - Qt::MouseButtons m_mousePressButtons; - QMutex m_sceneImageLock; - QImage *m_currentSceneImage; - bool m_updatePending; - Qt::HANDLE m_paintThreadId; - Qt::HANDLE m_guiThreadId; -#endif - DeclarativeMargins *m_margins; -}; - -QTCOMMERCIALCHART_END_NAMESPACE - -#endif // DECLARATIVECHART_H diff --git a/plugins/declarative/declarativelineseries.cpp b/plugins/declarative/declarativelineseries.cpp deleted file mode 100644 index 61cf4e8e..00000000 --- a/plugins/declarative/declarativelineseries.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "declarativelineseries.h" - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -DeclarativeLineSeries::DeclarativeLineSeries(QObject *parent) : - QLineSeries(parent), - m_axes(new DeclarativeAxes(this)) -{ - connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisAngularChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisRadialChanged(QAbstractAxis*))); - connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int))); - connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int))); -} - -void DeclarativeLineSeries::handleCountChanged(int index) -{ - Q_UNUSED(index) - emit countChanged(points().count()); -} - -qreal DeclarativeLineSeries::width() const -{ - return pen().widthF(); -} - -void DeclarativeLineSeries::setWidth(qreal width) -{ - if (width != pen().widthF()) { - QPen p = pen(); - p.setWidthF(width); - setPen(p); - emit widthChanged(width); - } -} - -Qt::PenStyle DeclarativeLineSeries::style() const -{ - return pen().style(); -} - -void DeclarativeLineSeries::setStyle(Qt::PenStyle style) -{ - if (style != pen().style()) { - QPen p = pen(); - p.setStyle(style); - setPen(p); - emit styleChanged(style); - } -} - -Qt::PenCapStyle DeclarativeLineSeries::capStyle() const -{ - return pen().capStyle(); -} - -void DeclarativeLineSeries::setCapStyle(Qt::PenCapStyle capStyle) -{ - if (capStyle != pen().capStyle()) { - QPen p = pen(); - p.setCapStyle(capStyle); - setPen(p); - emit capStyleChanged(capStyle); - } -} - -QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeLineSeries::declarativeChildren() -{ - return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &appendDeclarativeChildren LIST_PROPERTY_PARAM_DEFAULTS); -} - -void DeclarativeLineSeries::appendDeclarativeChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element) -{ - Q_UNUSED(list) - Q_UNUSED(element) - // Empty implementation, children are parsed in componentComplete -} - -#include "moc_declarativelineseries.cpp" - -QTCOMMERCIALCHART_END_NAMESPACE diff --git a/plugins/declarative/declarativelineseries.h b/plugins/declarative/declarativelineseries.h deleted file mode 100644 index 3b904f27..00000000 --- a/plugins/declarative/declarativelineseries.h +++ /dev/null @@ -1,123 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVELINESERIES_H -#define DECLARATIVELINESERIES_H - -#include "qlineseries.h" -#include "declarativexyseries.h" -#include "declarativeaxes.h" -#include "shared_defines.h" - -#ifdef CHARTS_FOR_QUICK2 -#include <QtQml/QQmlListProperty> -#include <QtQml/QQmlParserStatus> -#else -#include <QtDeclarative/QDeclarativeListProperty> -#include <QtDeclarative/QDeclarativeParserStatus> -#endif - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -class DeclarativeLineSeries : public QLineSeries, public DeclarativeXySeries, public QDECLARATIVE_PARSER_STATUS -{ - Q_OBJECT -#ifdef CHARTS_FOR_QUICK2 - Q_INTERFACES(QQmlParserStatus) -#else - Q_INTERFACES(QDeclarativeParserStatus) -#endif - 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) -#ifdef CHARTS_FOR_QUICK2 - Q_PROPERTY(QQmlListProperty<QObject> declarativeChildren READ declarativeChildren) -#else - Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren) -#endif - 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); } - Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - Q_REVISION(3) QAbstractAxis *axisAngular() { return m_axes->axisX(); } - Q_REVISION(3) void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); } - Q_REVISION(3) QAbstractAxis *axisRadial() { return m_axes->axisY(); } - Q_REVISION(3) 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); - QDECLARATIVE_LIST_PROPERTY<QObject> 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_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(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element); - void handleCountChanged(int index); - -public: - DeclarativeAxes *m_axes; -}; - -QTCOMMERCIALCHART_END_NAMESPACE - -#endif // DECLARATIVELINESERIES_H diff --git a/plugins/declarative/declarativemargins.cpp b/plugins/declarative/declarativemargins.cpp deleted file mode 100644 index 2010b3be..00000000 --- a/plugins/declarative/declarativemargins.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "declarativemargins.h" -#include <QDataStream> -#include <QDebug> - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -#ifdef QDOC_QT5 -/*! - \qmltype Margins - \inqmlmodule QtCommercial.Chart - - \include doc/src/margins.qdocinc -*/ -#else -/*! - \qmlclass Margins - - \include ../doc/src/margins.qdocinc -*/ -#endif - -/*! - \qmlproperty int Margins::top - The top margin. -*/ - -/*! - \qmlproperty int Margins::bottom - The bottom margin. -*/ - -/*! - \qmlproperty int Margins::left - The left margin. -*/ - -/*! - \qmlproperty int Margins::right - The right margin. -*/ - -DeclarativeMargins::DeclarativeMargins(QObject *parent) : - QObject(parent) -{ - QMargins::setTop(0); - QMargins::setBottom(0); - QMargins::setLeft(0); - QMargins::setRight(0); -} - -void DeclarativeMargins::setTop(int top) -{ - if (top < 0) { - qWarning() << "Cannot set top margin to a negative value:" << top; - } else { - if (top != QMargins::top()) { - QMargins::setTop(top); - emit topChanged(QMargins::top(), QMargins::bottom(), QMargins::left(), QMargins::right()); - } - } -} - -void DeclarativeMargins::setBottom(int bottom) -{ - if (bottom < 0) { - qWarning() << "Cannot set bottom margin to a negative value:" << bottom; - } else { - if (bottom != QMargins::bottom()) { - QMargins::setBottom(bottom); - emit bottomChanged(QMargins::top(), QMargins::bottom(), QMargins::left(), QMargins::right()); - } - } -} - -void DeclarativeMargins::setLeft(int left) -{ - if (left < 0) { - qWarning() << "Cannot set left margin to a negative value:" << left; - } else { - if (left != QMargins::left()) { - QMargins::setLeft(left); - emit leftChanged(QMargins::top(), QMargins::bottom(), QMargins::left(), QMargins::right()); - } - } -} - -void DeclarativeMargins::setRight(int right) -{ - if (right < 0) { - qWarning() << "Cannot set left margin to a negative value:" << right; - } else { - if (right != QMargins::right()) { - QMargins::setRight(right); - emit rightChanged(QMargins::top(), QMargins::bottom(), QMargins::left(), QMargins::right()); - } - } -} - -#include "moc_declarativemargins.cpp" - -QTCOMMERCIALCHART_END_NAMESPACE diff --git a/plugins/declarative/declarativemargins.h b/plugins/declarative/declarativemargins.h deleted file mode 100644 index 56823eaa..00000000 --- a/plugins/declarative/declarativemargins.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVE_MARGINS_H -#define DECLARATIVE_MARGINS_H - -#include "qchartglobal.h" -#include <QObject> -#include <QMargins> - -QTCOMMERCIALCHART_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); -}; - -QTCOMMERCIALCHART_END_NAMESPACE - -#endif // DECLARATIVE_MARGINS_H diff --git a/plugins/declarative/declarativepieseries.cpp b/plugins/declarative/declarativepieseries.cpp deleted file mode 100644 index 9107c573..00000000 --- a/plugins/declarative/declarativepieseries.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "declarativepieseries.h" -#include "qpieslice.h" -#include "qvpiemodelmapper.h" -#include "qhpiemodelmapper.h" - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -DeclarativePieSlice::DeclarativePieSlice(QObject *parent) - : QPieSlice(parent) -{ - connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged())); -} - -QString DeclarativePieSlice::brushFilename() const -{ - return m_brushFilename; -} - -void DeclarativePieSlice::setBrushFilename(const QString &brushFilename) -{ - QImage brushImage(brushFilename); - if (QPieSlice::brush().textureImage() != brushImage) { - QBrush brush = QPieSlice::brush(); - brush.setTextureImage(brushImage); - QPieSlice::setBrush(brush); - m_brushFilename = brushFilename; - m_brushImage = brushImage; - emit brushFilenameChanged(brushFilename); - } -} - -void DeclarativePieSlice::handleBrushChanged() -{ - // If the texture image of the brush has changed along the brush - // the brush file name needs to be cleared. - if (!m_brushFilename.isEmpty() && QPieSlice::brush().textureImage() != m_brushImage) { - m_brushFilename.clear(); - emit brushFilenameChanged(QString("")); - } -} - -// Declarative pie series ========================================================================= -DeclarativePieSeries::DeclarativePieSeries(QDECLARATIVE_ITEM *parent) : - QPieSeries(parent) -{ - connect(this, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleAdded(QList<QPieSlice*>))); - connect(this, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleRemoved(QList<QPieSlice*>))); -} - -void DeclarativePieSeries::classBegin() -{ -} - -void DeclarativePieSeries::componentComplete() -{ - foreach (QObject *child, children()) { - if (qobject_cast<QPieSlice *>(child)) { - QPieSeries::append(qobject_cast<QPieSlice *>(child)); - } else if (qobject_cast<QVPieModelMapper *>(child)) { - QVPieModelMapper *mapper = qobject_cast<QVPieModelMapper *>(child); - mapper->setSeries(this); - } else if (qobject_cast<QHPieModelMapper *>(child)) { - QHPieModelMapper *mapper = qobject_cast<QHPieModelMapper *>(child); - mapper->setSeries(this); - } - } -} - -QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativePieSeries::seriesChildren() -{ - return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativePieSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS); -} - -void DeclarativePieSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element) -{ - // Empty implementation; the children are parsed in componentComplete instead - Q_UNUSED(list); - Q_UNUSED(element); -} - -QPieSlice *DeclarativePieSeries::at(int index) -{ - QList<QPieSlice *> sliceList = slices(); - if (index >= 0 && index < sliceList.count()) - return sliceList[index]; - - return 0; -} - -QPieSlice *DeclarativePieSeries::find(QString label) -{ - foreach (QPieSlice *slice, slices()) { - if (slice->label() == label) - return slice; - } - return 0; -} - -DeclarativePieSlice *DeclarativePieSeries::append(QString label, qreal value) -{ - DeclarativePieSlice *slice = new DeclarativePieSlice(this); - slice->setLabel(label); - slice->setValue(value); - if (QPieSeries::append(slice)) - return slice; - delete slice; - return 0; -} - -bool DeclarativePieSeries::remove(QPieSlice *slice) -{ - return QPieSeries::remove(slice); -} - -void DeclarativePieSeries::clear() -{ - QPieSeries::clear(); -} - -void DeclarativePieSeries::handleAdded(QList<QPieSlice *> slices) -{ - foreach (QPieSlice *slice, slices) - emit sliceAdded(slice); -} - -void DeclarativePieSeries::handleRemoved(QList<QPieSlice *> slices) -{ - foreach (QPieSlice *slice, slices) - emit sliceRemoved(slice); -} - -#include "moc_declarativepieseries.cpp" - -QTCOMMERCIALCHART_END_NAMESPACE diff --git a/plugins/declarative/declarativepieseries.h b/plugins/declarative/declarativepieseries.h deleted file mode 100644 index c95d90be..00000000 --- a/plugins/declarative/declarativepieseries.h +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVEPIESERIES_H -#define DECLARATIVEPIESERIES_H - -#include "qpieseries.h" -#include "qpieslice.h" -#include "shared_defines.h" - -#ifdef CHARTS_FOR_QUICK2 -#include <QtQuick/QQuickItem> -#include <QtQml/QQmlParserStatus> -#else -#include <QtDeclarative/QDeclarativeItem> -#include <QtDeclarative/QDeclarativeParserStatus> -#endif - -QTCOMMERCIALCHART_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 QDECLARATIVE_PARSER_STATUS -{ - Q_OBJECT -#ifdef CHARTS_FOR_QUICK2 - Q_INTERFACES(QQmlParserStatus) - Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren) -#else - Q_INTERFACES(QDeclarativeParserStatus) - Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren) -#endif - Q_CLASSINFO("DefaultProperty", "seriesChildren") - -public: - explicit DeclarativePieSeries(QDECLARATIVE_ITEM *parent = 0); - QDECLARATIVE_LIST_PROPERTY<QObject> 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(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element); - void handleAdded(QList<QPieSlice *> slices); - void handleRemoved(QList<QPieSlice *> slices); -}; - -QTCOMMERCIALCHART_END_NAMESPACE - -#endif // DECLARATIVEPIESERIES_H diff --git a/plugins/declarative/declarativepolarchart.cpp b/plugins/declarative/declarativepolarchart.cpp deleted file mode 100644 index f1c937a4..00000000 --- a/plugins/declarative/declarativepolarchart.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "declarativepolarchart.h" -#include "qchart.h" - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -#ifdef QDOC_QT5 -/*! - \qmltype PolarChartView - \instantiates DeclarativePolarChart - \inqmlmodule QtCommercial.Chart - - \include doc/src/declarativepolarchart.qdocinc -*/ -#else -/*! - \qmlclass PolarChartView DeclarativePolarChart - - \include ../doc/src/declarativepolarchart.qdocinc -*/ -#endif - -DeclarativePolarChart::DeclarativePolarChart(QDECLARATIVE_ITEM *parent) - : DeclarativeChart(QChart::ChartTypePolar, parent) -{ -} - -DeclarativePolarChart::~DeclarativePolarChart() -{ -} - -#include "moc_declarativepolarchart.cpp" - -QTCOMMERCIALCHART_END_NAMESPACE diff --git a/plugins/declarative/declarativepolarchart.h b/plugins/declarative/declarativepolarchart.h deleted file mode 100644 index 3790dc71..00000000 --- a/plugins/declarative/declarativepolarchart.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVEPOLARCHART_H -#define DECLARATIVEPOLARCHART_H - -#include <QtCore/QtGlobal> -#include "shared_defines.h" - -#ifdef CHARTS_FOR_QUICK2 -#include <QtQuick/QQuickItem> -#else -#include <QtDeclarative/QDeclarativeItem> -#endif - -#include "declarativechart.h" - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -class DeclarativePolarChart : public DeclarativeChart -{ - Q_OBJECT -public: - DeclarativePolarChart(QDECLARATIVE_ITEM *parent = 0); - ~DeclarativePolarChart(); -}; - -QTCOMMERCIALCHART_END_NAMESPACE - -#endif // DECLARATIVEPOLARCHART_H diff --git a/plugins/declarative/declarativescatterseries.cpp b/plugins/declarative/declarativescatterseries.cpp deleted file mode 100644 index 9314db4d..00000000 --- a/plugins/declarative/declarativescatterseries.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "declarativescatterseries.h" - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -DeclarativeScatterSeries::DeclarativeScatterSeries(QObject *parent) : - QScatterSeries(parent), - m_axes(new DeclarativeAxes(this)) -{ - connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisAngularChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisRadialChanged(QAbstractAxis*))); - connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int))); - connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int))); - connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged())); -} - -void DeclarativeScatterSeries::handleCountChanged(int index) -{ - Q_UNUSED(index) - emit countChanged(QScatterSeries::count()); -} - -qreal DeclarativeScatterSeries::borderWidth() const -{ - return pen().widthF(); -} - -void DeclarativeScatterSeries::setBorderWidth(qreal width) -{ - if (width != pen().widthF()) { - QPen p = pen(); - p.setWidthF(width); - setPen(p); - emit borderWidthChanged(width); - } -} - -QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeScatterSeries::declarativeChildren() -{ - return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &appendDeclarativeChildren LIST_PROPERTY_PARAM_DEFAULTS); -} - -void DeclarativeScatterSeries::appendDeclarativeChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element) -{ - Q_UNUSED(list) - Q_UNUSED(element) - // Empty implementation, children are parsed in componentComplete -} - -QString DeclarativeScatterSeries::brushFilename() const -{ - return m_brushFilename; -} - -void DeclarativeScatterSeries::setBrushFilename(const QString &brushFilename) -{ - QImage brushImage(brushFilename); - if (QScatterSeries::brush().textureImage() != brushImage) { - QBrush brush = QScatterSeries::brush(); - brush.setTextureImage(brushImage); - QScatterSeries::setBrush(brush); - m_brushFilename = brushFilename; - m_brushImage = brushImage; - emit brushFilenameChanged(brushFilename); - } -} - -void DeclarativeScatterSeries::setBrush(const QBrush &brush) -{ - QScatterSeries::setBrush(brush); - emit brushChanged(); -} - -QBrush DeclarativeScatterSeries::brush() const -{ - return QScatterSeries::brush(); -} - -void DeclarativeScatterSeries::handleBrushChanged() -{ - // If the texture image of the brush has changed along the brush - // the brush file name needs to be cleared. - if (!m_brushFilename.isEmpty() && QScatterSeries::brush().textureImage() != m_brushImage) { - m_brushFilename.clear(); - emit brushFilenameChanged(QString("")); - } -} - -#include "moc_declarativescatterseries.cpp" - -QTCOMMERCIALCHART_END_NAMESPACE diff --git a/plugins/declarative/declarativescatterseries.h b/plugins/declarative/declarativescatterseries.h deleted file mode 100644 index 73b1c0c4..00000000 --- a/plugins/declarative/declarativescatterseries.h +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVESCATTERSERIES_H -#define DECLARATIVESCATTERSERIES_H - -#include "qscatterseries.h" -#include "declarativexyseries.h" -#include "declarativeaxes.h" -#include "shared_defines.h" - -#ifdef CHARTS_FOR_QUICK2 -#include <QtQml/QQmlListProperty> -#include <QtQml/QQmlParserStatus> -#else -#include <QtDeclarative/QDeclarativeListProperty> -#include <QtDeclarative/QDeclarativeParserStatus> -#endif - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -class DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeries, public QDECLARATIVE_PARSER_STATUS -{ - Q_OBJECT -#ifdef CHARTS_FOR_QUICK2 - Q_INTERFACES(QQmlParserStatus) -#else - Q_INTERFACES(QDeclarativeParserStatus) -#endif - 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) -#ifdef CHARTS_FOR_QUICK2 - Q_PROPERTY(QQmlListProperty<QObject> declarativeChildren READ declarativeChildren) -#else - Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren) -#endif - 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); } - Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - Q_REVISION(3) QAbstractAxis *axisAngular() { return m_axes->axisX(); } - Q_REVISION(3) void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); } - Q_REVISION(3) QAbstractAxis *axisRadial() { return m_axes->axisY(); } - Q_REVISION(3) void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); } - qreal borderWidth() const; - void setBorderWidth(qreal borderWidth); - QDECLARATIVE_LIST_PROPERTY<QObject> 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_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(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element); - void handleCountChanged(int index); - -private Q_SLOTS: - void handleBrushChanged(); - -public: - DeclarativeAxes *m_axes; - -private: - QString m_brushFilename; - QImage m_brushImage; -}; - -QTCOMMERCIALCHART_END_NAMESPACE - -#endif // DECLARATIVESCATTERSERIES_H diff --git a/plugins/declarative/declarativesplineseries.cpp b/plugins/declarative/declarativesplineseries.cpp deleted file mode 100644 index d099f86b..00000000 --- a/plugins/declarative/declarativesplineseries.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "declarativesplineseries.h" - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -DeclarativeSplineSeries::DeclarativeSplineSeries(QObject *parent) : - QSplineSeries(parent), - m_axes(new DeclarativeAxes(this)) -{ - connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisAngularChanged(QAbstractAxis*))); - connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisRadialChanged(QAbstractAxis*))); - connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int))); - connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int))); -} - -void DeclarativeSplineSeries::handleCountChanged(int index) -{ - Q_UNUSED(index) - emit countChanged(points().count()); -} - -qreal DeclarativeSplineSeries::width() const -{ - return pen().widthF(); -} - -void DeclarativeSplineSeries::setWidth(qreal width) -{ - if (width != pen().widthF()) { - QPen p = pen(); - p.setWidthF(width); - setPen(p); - emit widthChanged(width); - } -} - -Qt::PenStyle DeclarativeSplineSeries::style() const -{ - return pen().style(); -} - -void DeclarativeSplineSeries::setStyle(Qt::PenStyle style) -{ - if (style != pen().style()) { - QPen p = pen(); - p.setStyle(style); - setPen(p); - emit styleChanged(style); - } -} - -Qt::PenCapStyle DeclarativeSplineSeries::capStyle() const -{ - return pen().capStyle(); -} - -void DeclarativeSplineSeries::setCapStyle(Qt::PenCapStyle capStyle) -{ - if (capStyle != pen().capStyle()) { - QPen p = pen(); - p.setCapStyle(capStyle); - setPen(p); - emit capStyleChanged(capStyle); - } -} - -QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeSplineSeries::declarativeChildren() -{ - return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &appendDeclarativeChildren LIST_PROPERTY_PARAM_DEFAULTS); -} - -void DeclarativeSplineSeries::appendDeclarativeChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element) -{ - Q_UNUSED(list) - Q_UNUSED(element) - // Empty implementation, children are parsed in componentComplete -} - -#include "moc_declarativesplineseries.cpp" - -QTCOMMERCIALCHART_END_NAMESPACE diff --git a/plugins/declarative/declarativesplineseries.h b/plugins/declarative/declarativesplineseries.h deleted file mode 100644 index a47e0579..00000000 --- a/plugins/declarative/declarativesplineseries.h +++ /dev/null @@ -1,123 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVESPLINESERIES_H -#define DECLARATIVESPLINESERIES_H - -#include "qsplineseries.h" -#include "declarativexyseries.h" -#include "declarativeaxes.h" -#include "shared_defines.h" - -#ifdef CHARTS_FOR_QUICK2 -#include <QtQml/QQmlListProperty> -#include <QtQml/QQmlParserStatus> -#else -#include <QtDeclarative/QDeclarativeListProperty> -#include <QtDeclarative/QDeclarativeParserStatus> -#endif - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -class DeclarativeSplineSeries : public QSplineSeries, public DeclarativeXySeries, public QDECLARATIVE_PARSER_STATUS -{ - Q_OBJECT -#ifdef CHARTS_FOR_QUICK2 - Q_INTERFACES(QQmlParserStatus) -#else - Q_INTERFACES(QDeclarativeParserStatus) -#endif - 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) -#ifdef CHARTS_FOR_QUICK2 - Q_PROPERTY(QQmlListProperty<QObject> declarativeChildren READ declarativeChildren) -#else - Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren) -#endif - 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); } - Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); } - Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); } - Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); } - Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); } - Q_REVISION(3) QAbstractAxis *axisAngular() { return m_axes->axisX(); } - Q_REVISION(3) void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); } - Q_REVISION(3) QAbstractAxis *axisRadial() { return m_axes->axisY(); } - Q_REVISION(3) 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); - QDECLARATIVE_LIST_PROPERTY<QObject> 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_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(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element); - void handleCountChanged(int index); - -public: - DeclarativeAxes *m_axes; -}; - -QTCOMMERCIALCHART_END_NAMESPACE - -#endif // DECLARATIVESPLINESERIES_H diff --git a/plugins/declarative/declarativexypoint.cpp b/plugins/declarative/declarativexypoint.cpp deleted file mode 100644 index b61ad2e4..00000000 --- a/plugins/declarative/declarativexypoint.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "declarativexypoint.h" -#include <QDataStream> - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -#ifdef QDOC_QT5 -/*! - \qmltype XYPoint - \inqmlmodule QtCommercial.Chart - - \include doc/src/declarativexypoint.qdocinc -*/ -#else -/*! - \qmlclass XYPoint QPointF - - \include ../doc/src/declarativexypoint.qdocinc -*/ -#endif - -/*! - \qmlproperty real XYPoint::x - The x-coordinate of the point. -*/ - -/*! - \qmlproperty real XYPoint::y - The y-coordinate of the point. -*/ - -DeclarativeXYPoint::DeclarativeXYPoint(QObject *parent) : - QObject(parent) -{ - setX(0.0); - setY(0.0); -} - -#include "moc_declarativexypoint.cpp" - -QTCOMMERCIALCHART_END_NAMESPACE diff --git a/plugins/declarative/declarativexypoint.h b/plugins/declarative/declarativexypoint.h deleted file mode 100644 index 70d04185..00000000 --- a/plugins/declarative/declarativexypoint.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVE_XY_POINT_H -#define DECLARATIVE_XY_POINT_H - -#include "qchartglobal.h" -#include <QObject> -#include <QPointF> - -QTCOMMERCIALCHART_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); -}; - -QTCOMMERCIALCHART_END_NAMESPACE - -#endif // DECLARATIVE_XY_POINT_H diff --git a/plugins/declarative/declarativexyseries.cpp b/plugins/declarative/declarativexyseries.cpp deleted file mode 100644 index 5ff69c50..00000000 --- a/plugins/declarative/declarativexyseries.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include "declarativexyseries.h" -#include "declarativexypoint.h" -#include "qvxymodelmapper.h" -#include "qhxymodelmapper.h" - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -DeclarativeXySeries::DeclarativeXySeries() -{ -} - -DeclarativeXySeries::~DeclarativeXySeries() -{ -} - -void DeclarativeXySeries::classBegin() -{ -} - -void DeclarativeXySeries::componentComplete() -{ - QXYSeries *series = qobject_cast<QXYSeries *>(xySeries()); - Q_ASSERT(series); - - foreach (QObject *child, series->children()) { - if (qobject_cast<DeclarativeXYPoint *>(child)) { - DeclarativeXYPoint *point = qobject_cast<DeclarativeXYPoint *>(child); - series->append(point->x(), point->y()); - } else if (qobject_cast<QVXYModelMapper *>(child)) { - QVXYModelMapper *mapper = qobject_cast<QVXYModelMapper *>(child); - mapper->setSeries(series); - } else if (qobject_cast<QHXYModelMapper *>(child)) { - QHXYModelMapper *mapper = qobject_cast<QHXYModelMapper *>(child); - mapper->setSeries(series); - } - } -} - -void DeclarativeXySeries::append(qreal x, qreal y) -{ - QXYSeries *series = qobject_cast<QXYSeries *>(xySeries()); - Q_ASSERT(series); - series->append(x, y); -} - -void DeclarativeXySeries::replace(qreal oldX, qreal oldY, qreal newX, qreal newY) -{ - QXYSeries *series = qobject_cast<QXYSeries *>(xySeries()); - Q_ASSERT(series); - series->replace(oldX, oldY, newX, newY); -} - -void DeclarativeXySeries::replace(int index, qreal newX, qreal newY) -{ - QXYSeries *series = qobject_cast<QXYSeries *>(xySeries()); - Q_ASSERT(series); - series->replace(index, newX, newY); -} - -void DeclarativeXySeries::remove(qreal x, qreal y) -{ - QXYSeries *series = qobject_cast<QXYSeries *>(xySeries()); - Q_ASSERT(series); - series->remove(x, y); -} - -void DeclarativeXySeries::remove(int index) -{ - QXYSeries *series = qobject_cast<QXYSeries *>(xySeries()); - Q_ASSERT(series); - series->remove(index); -} - -void DeclarativeXySeries::insert(int index, qreal x, qreal y) -{ - QXYSeries *series = qobject_cast<QXYSeries *>(xySeries()); - Q_ASSERT(series); - series->insert(index, QPointF(x, y)); -} - -void DeclarativeXySeries::clear() -{ - QXYSeries *series = qobject_cast<QXYSeries *>(xySeries()); - Q_ASSERT(series); - series->clear(); -} - -QPointF DeclarativeXySeries::at(int index) -{ - QXYSeries *series = qobject_cast<QXYSeries *>(xySeries()); - Q_ASSERT(series); - if (index >= 0 || index < series->count()) - return series->points().at(index); - return QPointF(0, 0); -} - -QTCOMMERCIALCHART_END_NAMESPACE diff --git a/plugins/declarative/declarativexyseries.h b/plugins/declarative/declarativexyseries.h deleted file mode 100644 index 8ac8dd27..00000000 --- a/plugins/declarative/declarativexyseries.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVE_XY_SERIES_H -#define DECLARATIVE_XY_SERIES_H - -#include <QXYSeries> - -QTCOMMERCIALCHART_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 insert(int index, qreal x, qreal y); - void clear(); - QPointF at(int index); -}; - -QTCOMMERCIALCHART_END_NAMESPACE - -#endif // DECLARATIVE_XY_SERIES_H diff --git a/plugins/declarative/plugin.cpp b/plugins/declarative/plugin.cpp deleted file mode 100644 index 1dad0dc0..00000000 --- a/plugins/declarative/plugin.cpp +++ /dev/null @@ -1,332 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qchart.h" -#include "qabstractaxis.h" -#include "qvalueaxis.h" -#include "qlogvalueaxis.h" -#include "declarativecategoryaxis.h" -#include "qbarcategoryaxis.h" -#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 "declarativepieseries.h" -#include "declarativeaxes.h" -#include "qvxymodelmapper.h" -#include "qhxymodelmapper.h" -#include "qhpiemodelmapper.h" -#include "qvpiemodelmapper.h" -#include "qhbarmodelmapper.h" -#include "qvbarmodelmapper.h" -#include "declarativemargins.h" -#include "qarealegendmarker.h" -#include "qbarlegendmarker.h" -#include "qpielegendmarker.h" -#include "qxylegendmarker.h" -#include "qboxplotmodelmapper.h" -#include "qvboxplotmodelmapper.h" -#ifndef QT_ON_ARM - #include "qdatetimeaxis.h" -#endif -#include "shared_defines.h" -#include <QAbstractItemModel> -#ifdef CHARTS_FOR_QUICK2 -#include <QtQml/QQmlExtensionPlugin> -#else -#include <QtDeclarative/qdeclarativeextensionplugin.h> -#include <QtDeclarative/qdeclarative.h> -#endif - -QTCOMMERCIALCHART_USE_NAMESPACE - -Q_DECLARE_METATYPE(QList<QPieSlice *>) -Q_DECLARE_METATYPE(QList<QBarSet *>) -Q_DECLARE_METATYPE(QList<QAbstractAxis *>) - -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) - -Q_DECLARE_METATYPE(DeclarativeChart *) -Q_DECLARE_METATYPE(DeclarativePolarChart *) -Q_DECLARE_METATYPE(DeclarativeMargins *) -Q_DECLARE_METATYPE(DeclarativeAreaSeries *) -Q_DECLARE_METATYPE(DeclarativeBarSeries *) -Q_DECLARE_METATYPE(DeclarativeBarSet *) -Q_DECLARE_METATYPE(DeclarativeBoxPlotSeries *) -Q_DECLARE_METATYPE(DeclarativeBoxSet *) -Q_DECLARE_METATYPE(DeclarativeLineSeries *) -Q_DECLARE_METATYPE(DeclarativePieSeries *) -Q_DECLARE_METATYPE(DeclarativePieSlice *) -Q_DECLARE_METATYPE(DeclarativeScatterSeries *) -Q_DECLARE_METATYPE(DeclarativeSplineSeries *) - -Q_DECLARE_METATYPE(QAbstractAxis *) -Q_DECLARE_METATYPE(QValueAxis *) -Q_DECLARE_METATYPE(QBarCategoryAxis *) -Q_DECLARE_METATYPE(QCategoryAxis *) -Q_DECLARE_METATYPE(QDateTimeAxis *) -Q_DECLARE_METATYPE(QLogValueAxis *) - -Q_DECLARE_METATYPE(QLegend *) -Q_DECLARE_METATYPE(QLegendMarker *) -Q_DECLARE_METATYPE(QAreaLegendMarker *) -Q_DECLARE_METATYPE(QBarLegendMarker *) -Q_DECLARE_METATYPE(QPieLegendMarker *) - -Q_DECLARE_METATYPE(QHPieModelMapper *) -Q_DECLARE_METATYPE(QHXYModelMapper *) -Q_DECLARE_METATYPE(QPieModelMapper *) -Q_DECLARE_METATYPE(QHBarModelMapper *) -Q_DECLARE_METATYPE(QBarModelMapper *) -Q_DECLARE_METATYPE(QVBarModelMapper *) -Q_DECLARE_METATYPE(QVPieModelMapper *) -Q_DECLARE_METATYPE(QVXYModelMapper *) -Q_DECLARE_METATYPE(QXYLegendMarker *) -Q_DECLARE_METATYPE(QXYModelMapper *) -Q_DECLARE_METATYPE(QBoxPlotModelMapper *) -Q_DECLARE_METATYPE(QVBoxPlotModelMapper *) - - -Q_DECLARE_METATYPE(QAbstractSeries *) -Q_DECLARE_METATYPE(QXYSeries *) -Q_DECLARE_METATYPE(QAbstractBarSeries *) -Q_DECLARE_METATYPE(QBarSeries *) -Q_DECLARE_METATYPE(QBarSet *) -Q_DECLARE_METATYPE(QAreaSeries *) -Q_DECLARE_METATYPE(QHorizontalBarSeries *) -Q_DECLARE_METATYPE(QHorizontalPercentBarSeries *) -Q_DECLARE_METATYPE(QHorizontalStackedBarSeries *) -Q_DECLARE_METATYPE(QLineSeries *) -Q_DECLARE_METATYPE(QPercentBarSeries *) -Q_DECLARE_METATYPE(QPieSeries *) -Q_DECLARE_METATYPE(QPieSlice *) -Q_DECLARE_METATYPE(QScatterSeries *) -Q_DECLARE_METATYPE(QSplineSeries *) -Q_DECLARE_METATYPE(QStackedBarSeries *) - -#endif - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -class ChartQmlPlugin : public QDECLARATIVE_EXTENSION_PLUGIN -{ - Q_OBJECT - -#ifdef CHARTS_FOR_QUICK2 - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") -#else -# if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface") -# endif -#endif - -public: - virtual void registerTypes(const char *uri) - { - Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCommercial.Chart")); - - qRegisterMetaType<QList<QPieSlice *> >(); - qRegisterMetaType<QList<QBarSet *> >(); - qRegisterMetaType<QList<QAbstractAxis *> >(); - - // QtCommercial.Chart 1.0 - qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView"); - qmlRegisterType<DeclarativeXYPoint>(uri, 1, 0, "XYPoint"); - qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries"); - qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries"); - qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries"); - qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries"); - qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries"); - qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries"); - qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries"); - qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries"); - qmlRegisterType<QPieSlice>(uri, 1, 0, "PieSlice"); - qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet"); - qmlRegisterType<QHXYModelMapper>(uri, 1, 0, "HXYModelMapper"); - qmlRegisterType<QVXYModelMapper>(uri, 1, 0, "VXYModelMapper"); - qmlRegisterType<QHPieModelMapper>(uri, 1, 0, "HPieModelMapper"); - qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper"); - qmlRegisterType<QHBarModelMapper>(uri, 1, 0, "HBarModelMapper"); - qmlRegisterType<QVBarModelMapper>(uri, 1, 0, "VBarModelMapper"); - - qmlRegisterType<QValueAxis>(uri, 1, 0, "ValuesAxis"); - qmlRegisterType<QBarCategoryAxis>(uri, 1, 0, "BarCategoriesAxis"); - qmlRegisterUncreatableType<QLegend>(uri, 1, 0, "Legend", - QLatin1String("Trying to create uncreatable: Legend.")); - qmlRegisterUncreatableType<QXYSeries>(uri, 1, 0, "XYSeries", - QLatin1String("Trying to create uncreatable: XYSeries.")); - qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel", - QLatin1String("Trying to create uncreatable: AbstractItemModel.")); - qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper", - QLatin1String("Trying to create uncreatable: XYModelMapper.")); - qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper", - QLatin1String("Trying to create uncreatable: PieModelMapper.")); - qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 0, "BarModelMapper", - QLatin1String("Trying to create uncreatable: BarModelMapper.")); - qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 0, "AbstractSeries", - QLatin1String("Trying to create uncreatable: AbstractSeries.")); - qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 1, 0, "AbstractBarSeries", - QLatin1String("Trying to create uncreatable: AbstractBarSeries.")); - qmlRegisterUncreatableType<QAbstractAxis>(uri, 1, 0, "AbstractAxis", - QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead.")); - qmlRegisterUncreatableType<QBarSet>(uri, 1, 0, "BarSetBase", - QLatin1String("Trying to create uncreatable: BarsetBase.")); - qmlRegisterUncreatableType<QPieSeries>(uri, 1, 0, "QPieSeries", - QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead.")); - qmlRegisterUncreatableType<DeclarativeAxes>(uri, 1, 0, "DeclarativeAxes", - QLatin1String("Trying to create uncreatable: DeclarativeAxes.")); - - // QtCommercial.Chart 1.1 - qmlRegisterType<DeclarativeChart, 1>(uri, 1, 1, "ChartView"); - qmlRegisterType<DeclarativeScatterSeries, 1>(uri, 1, 1, "ScatterSeries"); - qmlRegisterType<DeclarativeLineSeries, 1>(uri, 1, 1, "LineSeries"); - qmlRegisterType<DeclarativeSplineSeries, 1>(uri, 1, 1, "SplineSeries"); - qmlRegisterType<DeclarativeAreaSeries, 1>(uri, 1, 1, "AreaSeries"); - qmlRegisterType<DeclarativeBarSeries, 1>(uri, 1, 1, "BarSeries"); - qmlRegisterType<DeclarativeStackedBarSeries, 1>(uri, 1, 1, "StackedBarSeries"); - qmlRegisterType<DeclarativePercentBarSeries, 1>(uri, 1, 1, "PercentBarSeries"); - qmlRegisterType<DeclarativeHorizontalBarSeries, 1>(uri, 1, 1, "HorizontalBarSeries"); - qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 1>(uri, 1, 1, "HorizontalStackedBarSeries"); - qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 1>(uri, 1, 1, "HorizontalPercentBarSeries"); - qmlRegisterType<DeclarativePieSeries>(uri, 1, 1, "PieSeries"); - qmlRegisterType<DeclarativeBarSet>(uri, 1, 1, "BarSet"); - qmlRegisterType<QValueAxis>(uri, 1, 1, "ValueAxis"); -#ifndef QT_ON_ARM - qmlRegisterType<QDateTimeAxis>(uri, 1, 1, "DateTimeAxis"); -#endif - qmlRegisterType<DeclarativeCategoryAxis>(uri, 1, 1, "CategoryAxis"); - qmlRegisterType<DeclarativeCategoryRange>(uri, 1, 1, "CategoryRange"); - qmlRegisterType<QBarCategoryAxis>(uri, 1, 1, "BarCategoryAxis"); - qmlRegisterUncreatableType<DeclarativeMargins>(uri, 1, 1, "Margins", - QLatin1String("Trying to create uncreatable: Margins.")); - - // QtCommercial.Chart 1.2 - qmlRegisterType<DeclarativeChart, 2>(uri, 1, 2, "ChartView"); - qmlRegisterType<DeclarativeScatterSeries, 2>(uri, 1, 2, "ScatterSeries"); - qmlRegisterType<DeclarativeLineSeries, 2>(uri, 1, 2, "LineSeries"); - qmlRegisterType<DeclarativeSplineSeries, 2>(uri, 1, 2, "SplineSeries"); - qmlRegisterType<DeclarativeAreaSeries, 2>(uri, 1, 2, "AreaSeries"); - qmlRegisterType<DeclarativeBarSeries, 2>(uri, 1, 2, "BarSeries"); - qmlRegisterType<DeclarativeStackedBarSeries, 2>(uri, 1, 2, "StackedBarSeries"); - qmlRegisterType<DeclarativePercentBarSeries, 2>(uri, 1, 2, "PercentBarSeries"); - qmlRegisterType<DeclarativeHorizontalBarSeries, 2>(uri, 1, 2, "HorizontalBarSeries"); - qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 2>(uri, 1, 2, "HorizontalStackedBarSeries"); - qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 2>(uri, 1, 2, "HorizontalPercentBarSeries"); - - // QtCommercial.Chart 1.3 - qmlRegisterType<DeclarativeChart, 3>(uri, 1, 3, "ChartView"); - qmlRegisterType<DeclarativePolarChart, 1>(uri, 1, 3, "PolarChartView"); - qmlRegisterType<DeclarativeSplineSeries, 3>(uri, 1, 3, "SplineSeries"); - qmlRegisterType<DeclarativeScatterSeries, 3>(uri, 1, 3, "ScatterSeries"); - qmlRegisterType<DeclarativeLineSeries, 3>(uri, 1, 3, "LineSeries"); - qmlRegisterType<DeclarativeAreaSeries, 3>(uri, 1, 3, "AreaSeries"); - qmlRegisterType<QLogValueAxis>(uri, 1, 3, "LogValueAxis"); - qmlRegisterType<DeclarativeBoxPlotSeries>(uri, 1, 3, "BoxPlotSeries"); - qmlRegisterType<DeclarativeBoxSet>(uri, 1, 3, "BoxSet"); - - // QtCommercial.Chart 1.4 - qmlRegisterType<DeclarativeAreaSeries, 4>(uri, 1, 4, "AreaSeries"); - qmlRegisterType<DeclarativeBarSet, 2>(uri, 1, 4, "BarSet"); - qmlRegisterType<DeclarativeBoxPlotSeries, 1>(uri, 1, 4, "BoxPlotSeries"); - qmlRegisterType<DeclarativeBoxSet, 1>(uri, 1, 4, "BoxSet"); - qmlRegisterType<DeclarativePieSlice>(uri, 1, 4, "PieSlice"); - qmlRegisterType<DeclarativeScatterSeries, 4>(uri, 1, 4, "ScatterSeries"); - - // QtCommercial.Chart 2.0 - qmlRegisterType<QVBoxPlotModelMapper>(uri, 2, 0, "VBoxPlotModelMapper"); - qmlRegisterUncreatableType<QBoxPlotModelMapper>(uri, 2, 0, "BoxPlotModelMapper", - QLatin1String("Trying to create uncreatable: BoxPlotModelMapper.")); - - // Re-register latest revisions for 2.0 - qmlRegisterType<DeclarativeChart, 4>(uri, 2, 0, "ChartView"); - qmlRegisterType<DeclarativeLineSeries, 3>(uri, 2, 0, "LineSeries"); - qmlRegisterType<DeclarativeScatterSeries, 4>(uri, 2, 0, "ScatterSeries"); - qmlRegisterType<DeclarativeSplineSeries, 3>(uri, 2, 0, "SplineSeries"); - qmlRegisterType<DeclarativeAreaSeries, 4>(uri, 2, 0, "AreaSeries"); - qmlRegisterType<DeclarativeBarSeries, 2>(uri, 2, 0, "BarSeries"); - qmlRegisterType<DeclarativeStackedBarSeries, 2>(uri, 2, 0, "StackedBarSeries"); - qmlRegisterType<DeclarativePercentBarSeries, 2>(uri, 2, 0, "PercentBarSeries"); - qmlRegisterType<DeclarativeHorizontalBarSeries, 2>(uri, 2, 0, "HorizontalBarSeries"); - qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 2>(uri, 2, 0, "HorizontalStackedBarSeries"); - qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 2>(uri, 2, 0, "HorizontalPercentBarSeries"); - qmlRegisterType<DeclarativeBarSet, 2>(uri, 2, 0, "BarSet"); - qmlRegisterType<DeclarativeBoxPlotSeries, 1>(uri, 2, 0, "BoxPlotSeries"); - qmlRegisterType<DeclarativeBoxSet, 1>(uri, 2, 0, "BoxSet"); - qmlRegisterType<DeclarativePieSlice>(uri, 2, 0, "PieSlice"); - qmlRegisterType<DeclarativePieSeries>(uri, 2, 0, "PieSeries"); - qmlRegisterType<DeclarativeXYPoint>(uri, 2, 0, "XYPoint"); - qmlRegisterType<QHXYModelMapper>(uri, 2, 0, "HXYModelMapper"); - qmlRegisterType<QVXYModelMapper>(uri, 2, 0, "VXYModelMapper"); - qmlRegisterType<QHPieModelMapper>(uri, 2, 0, "HPieModelMapper"); - qmlRegisterType<QVPieModelMapper>(uri, 2, 0, "VPieModelMapper"); - qmlRegisterType<QHBarModelMapper>(uri, 2, 0, "HBarModelMapper"); - qmlRegisterType<QVBarModelMapper>(uri, 2, 0, "VBarModelMapper"); - qmlRegisterType<QValueAxis>(uri, 2, 0, "ValueAxis"); -#ifndef QT_ON_ARM - qmlRegisterType<QDateTimeAxis>(uri, 2, 0, "DateTimeAxis"); -#endif - qmlRegisterType<DeclarativeCategoryAxis>(uri, 2, 0, "CategoryAxis"); - qmlRegisterType<DeclarativeCategoryRange>(uri, 2, 0, "CategoryRange"); - qmlRegisterType<QBarCategoryAxis>(uri, 2, 0, "BarCategoryAxis"); - qmlRegisterUncreatableType<QLegend>(uri, 2, 0, "Legend", - QLatin1String("Trying to create uncreatable: Legend.")); - qmlRegisterUncreatableType<QXYSeries>(uri, 2, 0, "XYSeries", - QLatin1String("Trying to create uncreatable: XYSeries.")); - qmlRegisterUncreatableType<QAbstractItemModel>(uri, 2, 0, "AbstractItemModel", - QLatin1String("Trying to create uncreatable: AbstractItemModel.")); - qmlRegisterUncreatableType<QXYModelMapper>(uri, 2, 0, "XYModelMapper", - QLatin1String("Trying to create uncreatable: XYModelMapper.")); - qmlRegisterUncreatableType<QPieModelMapper>(uri, 2, 0, "PieModelMapper", - QLatin1String("Trying to create uncreatable: PieModelMapper.")); - qmlRegisterUncreatableType<QBarModelMapper>(uri, 2, 0, "BarModelMapper", - QLatin1String("Trying to create uncreatable: BarModelMapper.")); - qmlRegisterUncreatableType<QAbstractSeries>(uri, 2, 0, "AbstractSeries", - QLatin1String("Trying to create uncreatable: AbstractSeries.")); - qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 2, 0, "AbstractBarSeries", - QLatin1String("Trying to create uncreatable: AbstractBarSeries.")); - qmlRegisterUncreatableType<QAbstractAxis>(uri, 2, 0, "AbstractAxis", - QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead.")); - qmlRegisterUncreatableType<QBarSet>(uri, 2, 0, "BarSetBase", - QLatin1String("Trying to create uncreatable: BarsetBase.")); - qmlRegisterUncreatableType<QPieSeries>(uri, 2, 0, "QPieSeries", - QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead.")); - qmlRegisterUncreatableType<DeclarativeAxes>(uri, 2, 0, "DeclarativeAxes", - QLatin1String("Trying to create uncreatable: DeclarativeAxes.")); - qmlRegisterUncreatableType<DeclarativeMargins>(uri, 2, 0, "Margins", - QLatin1String("Trying to create uncreatable: Margins.")); - qmlRegisterType<DeclarativePolarChart>(uri, 2, 0, "PolarChartView"); - qmlRegisterType<QLogValueAxis>(uri, 2, 0, "LogValueAxis"); - } -}; - -QTCOMMERCIALCHART_END_NAMESPACE - -#include "plugin.moc" - -QTCOMMERCIALCHART_USE_NAMESPACE - -#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) - Q_EXPORT_PLUGIN2(qtcommercialchartqml, QT_PREPEND_NAMESPACE(ChartQmlPlugin)) -#endif diff --git a/plugins/declarative/shared_defines.h b/plugins/declarative/shared_defines.h deleted file mode 100644 index d30efb84..00000000 --- a/plugins/declarative/shared_defines.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SHARED_DEFINES_H -#define SHARED_DEFINES_H - -#ifdef CHARTS_FOR_QUICK2 -#define QDECLARATIVE_ITEM QQuickItem -#define QDECLARATIVE_PAINTED_ITEM QQuickPaintedItem -#define QDECLARATIVE_LIST_PROPERTY QQmlListProperty -#define QDECLARATIVE_EXTENSION_PLUGIN QQmlExtensionPlugin -#define QDECLARATIVE_PARSER_STATUS QQmlParserStatus -#define LIST_PROPERTY_PARAM_DEFAULTS ,0,0,0 - -#else -#define QDECLARATIVE_ITEM QDeclarativeItem -#define QDECLARATIVE_PAINTED_ITEM QDeclarativeItem -#define QDECLARATIVE_LIST_PROPERTY QDeclarativeListProperty -#define QDECLARATIVE_EXTENSION_PLUGIN QDeclarativeExtensionPlugin -#define QDECLARATIVE_PARSER_STATUS QDeclarativeParserStatus -#define LIST_PROPERTY_PARAM_DEFAULTS ,0,0 - -#endif - -#endif // SHARED_DEFINES_H |