/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Charts module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:GPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 or (at your option) any later version ** approved by the KDE Free Qt Foundation. The licenses are as published by ** the Free Software Foundation and appearing in the file LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include #include #include #include #include "declarativecategoryaxis.h" #include #include "declarativechart.h" #include "declarativepolarchart.h" #include "declarativexypoint.h" #include "declarativelineseries.h" #include "declarativesplineseries.h" #include "declarativeareaseries.h" #include "declarativescatterseries.h" #include "declarativebarseries.h" #include "declarativeboxplotseries.h" #include "declarativepieseries.h" #include "declarativeaxes.h" #include #include #include #include #include #include #include "declarativemargins.h" #include #include #include #include #include #include #include #ifndef QT_QREAL_IS_FLOAT #include #endif #include #include QT_CHARTS_USE_NAMESPACE QML_DECLARE_TYPE(QList) QML_DECLARE_TYPE(QList) QML_DECLARE_TYPE(QList) QML_DECLARE_TYPE(DeclarativeChart) QML_DECLARE_TYPE(DeclarativePolarChart) QML_DECLARE_TYPE(DeclarativeMargins) QML_DECLARE_TYPE(DeclarativeAreaSeries) QML_DECLARE_TYPE(DeclarativeBarSeries) QML_DECLARE_TYPE(DeclarativeBarSet) QML_DECLARE_TYPE(DeclarativeBoxPlotSeries) QML_DECLARE_TYPE(DeclarativeBoxSet) QML_DECLARE_TYPE(DeclarativeLineSeries) QML_DECLARE_TYPE(DeclarativePieSeries) QML_DECLARE_TYPE(DeclarativePieSlice) QML_DECLARE_TYPE(DeclarativeScatterSeries) QML_DECLARE_TYPE(DeclarativeSplineSeries) QML_DECLARE_TYPE(QAbstractAxis) QML_DECLARE_TYPE(QValueAxis) QML_DECLARE_TYPE(QBarCategoryAxis) QML_DECLARE_TYPE(QCategoryAxis) #ifndef QT_QREAL_IS_FLOAT QML_DECLARE_TYPE(QDateTimeAxis) #endif QML_DECLARE_TYPE(QLogValueAxis) QML_DECLARE_TYPE(QLegend) QML_DECLARE_TYPE(QLegendMarker) QML_DECLARE_TYPE(QAreaLegendMarker) QML_DECLARE_TYPE(QBarLegendMarker) QML_DECLARE_TYPE(QPieLegendMarker) QML_DECLARE_TYPE(QHPieModelMapper) QML_DECLARE_TYPE(QHXYModelMapper) QML_DECLARE_TYPE(QPieModelMapper) QML_DECLARE_TYPE(QHBarModelMapper) QML_DECLARE_TYPE(QBarModelMapper) QML_DECLARE_TYPE(QVBarModelMapper) QML_DECLARE_TYPE(QVPieModelMapper) QML_DECLARE_TYPE(QVXYModelMapper) QML_DECLARE_TYPE(QXYLegendMarker) QML_DECLARE_TYPE(QXYModelMapper) QML_DECLARE_TYPE(QBoxPlotModelMapper) QML_DECLARE_TYPE(QHBoxPlotModelMapper) QML_DECLARE_TYPE(QVBoxPlotModelMapper) QML_DECLARE_TYPE(QAbstractSeries) QML_DECLARE_TYPE(QXYSeries) QML_DECLARE_TYPE(QAbstractBarSeries) QML_DECLARE_TYPE(QBarSeries) QML_DECLARE_TYPE(QBarSet) QML_DECLARE_TYPE(QAreaSeries) QML_DECLARE_TYPE(QHorizontalBarSeries) QML_DECLARE_TYPE(QHorizontalPercentBarSeries) QML_DECLARE_TYPE(QHorizontalStackedBarSeries) QML_DECLARE_TYPE(QLineSeries) QML_DECLARE_TYPE(QPercentBarSeries) QML_DECLARE_TYPE(QPieSeries) QML_DECLARE_TYPE(QPieSlice) QML_DECLARE_TYPE(QScatterSeries) QML_DECLARE_TYPE(QSplineSeries) QML_DECLARE_TYPE(QStackedBarSeries) QT_CHARTS_BEGIN_NAMESPACE class QtChartsQml2Plugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: virtual void registerTypes(const char *uri) { Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCharts")); // @uri QtCharts qRegisterMetaType >(); qRegisterMetaType >(); qRegisterMetaType >(); // QtCharts 1.0 qmlRegisterType(uri, 1, 0, "ChartView"); qmlRegisterType(uri, 1, 0, "XYPoint"); qmlRegisterType(uri, 1, 0, "ScatterSeries"); qmlRegisterType(uri, 1, 0, "LineSeries"); qmlRegisterType(uri, 1, 0, "SplineSeries"); qmlRegisterType(uri, 1, 0, "AreaSeries"); qmlRegisterType(uri, 1, 0, "BarSeries"); qmlRegisterType(uri, 1, 0, "StackedBarSeries"); qmlRegisterType(uri, 1, 0, "PercentBarSeries"); qmlRegisterType(uri, 1, 0, "PieSeries"); qmlRegisterType(uri, 1, 0, "PieSlice"); qmlRegisterType(uri, 1, 0, "BarSet"); qmlRegisterType(uri, 1, 0, "HXYModelMapper"); qmlRegisterType(uri, 1, 0, "VXYModelMapper"); qmlRegisterType(uri, 1, 0, "HPieModelMapper"); qmlRegisterType(uri, 1, 0, "VPieModelMapper"); qmlRegisterType(uri, 1, 0, "HBarModelMapper"); qmlRegisterType(uri, 1, 0, "VBarModelMapper"); qmlRegisterType(uri, 1, 0, "ValuesAxis"); qmlRegisterType(uri, 1, 0, "BarCategoriesAxis"); qmlRegisterUncreatableType(uri, 1, 0, "Legend", QLatin1String("Trying to create uncreatable: Legend.")); qmlRegisterUncreatableType(uri, 1, 0, "XYSeries", QLatin1String("Trying to create uncreatable: XYSeries.")); qmlRegisterUncreatableType(uri, 1, 0, "AbstractItemModel", QLatin1String("Trying to create uncreatable: AbstractItemModel.")); qmlRegisterUncreatableType(uri, 1, 0, "XYModelMapper", QLatin1String("Trying to create uncreatable: XYModelMapper.")); qmlRegisterUncreatableType(uri, 1, 0, "PieModelMapper", QLatin1String("Trying to create uncreatable: PieModelMapper.")); qmlRegisterUncreatableType(uri, 1, 0, "BarModelMapper", QLatin1String("Trying to create uncreatable: BarModelMapper.")); qmlRegisterUncreatableType(uri, 1, 0, "AbstractSeries", QLatin1String("Trying to create uncreatable: AbstractSeries.")); qmlRegisterUncreatableType(uri, 1, 0, "AbstractBarSeries", QLatin1String("Trying to create uncreatable: AbstractBarSeries.")); qmlRegisterUncreatableType(uri, 1, 0, "AbstractAxis", QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead.")); qmlRegisterUncreatableType(uri, 1, 0, "BarSetBase", QLatin1String("Trying to create uncreatable: BarsetBase.")); qmlRegisterUncreatableType(uri, 1, 0, "QPieSeries", QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead.")); qmlRegisterUncreatableType(uri, 1, 0, "DeclarativeAxes", QLatin1String("Trying to create uncreatable: DeclarativeAxes.")); // QtCharts 1.1 qmlRegisterType(uri, 1, 1, "ChartView"); qmlRegisterType(uri, 1, 1, "ScatterSeries"); qmlRegisterType(uri, 1, 1, "LineSeries"); qmlRegisterType(uri, 1, 1, "SplineSeries"); qmlRegisterType(uri, 1, 1, "AreaSeries"); qmlRegisterType(uri, 1, 1, "BarSeries"); qmlRegisterType(uri, 1, 1, "StackedBarSeries"); qmlRegisterType(uri, 1, 1, "PercentBarSeries"); qmlRegisterType(uri, 1, 1, "HorizontalBarSeries"); qmlRegisterType(uri, 1, 1, "HorizontalStackedBarSeries"); qmlRegisterType(uri, 1, 1, "HorizontalPercentBarSeries"); qmlRegisterType(uri, 1, 1, "PieSeries"); qmlRegisterType(uri, 1, 1, "BarSet"); qmlRegisterType(uri, 1, 1, "ValueAxis"); #ifndef QT_QREAL_IS_FLOAT qmlRegisterType(uri, 1, 1, "DateTimeAxis"); #endif qmlRegisterType(uri, 1, 1, "CategoryAxis"); qmlRegisterType(uri, 1, 1, "CategoryRange"); qmlRegisterType(uri, 1, 1, "BarCategoryAxis"); qmlRegisterUncreatableType(uri, 1, 1, "Margins", QLatin1String("Trying to create uncreatable: Margins.")); // QtCharts 1.2 qmlRegisterType(uri, 1, 2, "ChartView"); qmlRegisterType(uri, 1, 2, "ScatterSeries"); qmlRegisterType(uri, 1, 2, "LineSeries"); qmlRegisterType(uri, 1, 2, "SplineSeries"); qmlRegisterType(uri, 1, 2, "AreaSeries"); qmlRegisterType(uri, 1, 2, "BarSeries"); qmlRegisterType(uri, 1, 2, "StackedBarSeries"); qmlRegisterType(uri, 1, 2, "PercentBarSeries"); qmlRegisterType(uri, 1, 2, "HorizontalBarSeries"); qmlRegisterType(uri, 1, 2, "HorizontalStackedBarSeries"); qmlRegisterType(uri, 1, 2, "HorizontalPercentBarSeries"); // QtCharts 1.3 qmlRegisterType(uri, 1, 3, "ChartView"); qmlRegisterType(uri, 1, 3, "PolarChartView"); qmlRegisterType(uri, 1, 3, "SplineSeries"); qmlRegisterType(uri, 1, 3, "ScatterSeries"); qmlRegisterType(uri, 1, 3, "LineSeries"); qmlRegisterType(uri, 1, 3, "AreaSeries"); qmlRegisterType(uri, 1, 3, "LogValueAxis"); qmlRegisterType(uri, 1, 3, "BoxPlotSeries"); qmlRegisterType(uri, 1, 3, "BoxSet"); // QtCharts 1.4 qmlRegisterType(uri, 1, 4, "AreaSeries"); qmlRegisterType(uri, 1, 4, "BarSet"); qmlRegisterType(uri, 1, 4, "BoxPlotSeries"); qmlRegisterType(uri, 1, 4, "BoxSet"); qmlRegisterType(uri, 1, 4, "PieSlice"); qmlRegisterType(uri, 1, 4, "ScatterSeries"); // QtCharts 2.0 qmlRegisterType(uri, 2, 0, "HBoxPlotModelMapper"); qmlRegisterType(uri, 2, 0, "VBoxPlotModelMapper"); qmlRegisterUncreatableType(uri, 2, 0, "BoxPlotModelMapper", QLatin1String("Trying to create uncreatable: BoxPlotModelMapper.")); qmlRegisterType(uri, 2, 0, "ChartView"); qmlRegisterType(uri, 2, 0, "XYPoint"); qmlRegisterType(uri, 2, 0, "ScatterSeries"); qmlRegisterType(uri, 2, 0, "LineSeries"); qmlRegisterType(uri, 2, 0, "SplineSeries"); qmlRegisterType(uri, 2, 0, "AreaSeries"); qmlRegisterType(uri, 2, 0, "BarSeries"); qmlRegisterType(uri, 2, 0, "StackedBarSeries"); qmlRegisterType(uri, 2, 0, "PercentBarSeries"); qmlRegisterType(uri, 2, 0, "PieSeries"); qmlRegisterType(uri, 2, 0, "PieSlice"); qmlRegisterType(uri, 2, 0, "BarSet"); qmlRegisterType(uri, 2, 0, "HXYModelMapper"); qmlRegisterType(uri, 2, 0, "VXYModelMapper"); qmlRegisterType(uri, 2, 0, "HPieModelMapper"); qmlRegisterType(uri, 2, 0, "VPieModelMapper"); qmlRegisterType(uri, 2, 0, "HBarModelMapper"); qmlRegisterType(uri, 2, 0, "VBarModelMapper"); qmlRegisterType(uri, 2, 0, "ValueAxis"); #ifndef QT_QREAL_IS_FLOAT qmlRegisterType(uri, 2, 0, "DateTimeAxis"); #endif qmlRegisterType(uri, 2, 0, "CategoryAxis"); qmlRegisterType(uri, 2, 0, "CategoryRange"); qmlRegisterType(uri, 2, 0, "BarCategoryAxis"); qmlRegisterType(uri, 2, 0, "PolarChartView"); qmlRegisterType(uri, 2, 0, "LogValueAxis"); qmlRegisterType(uri, 2, 0, "BoxPlotSeries"); qmlRegisterType(uri, 2, 0, "BoxSet"); qmlRegisterType(uri, 2, 0, "HorizontalBarSeries"); qmlRegisterType(uri, 2, 0, "HorizontalStackedBarSeries"); qmlRegisterType(uri, 2, 0, "HorizontalPercentBarSeries"); qmlRegisterType(uri, 2, 0, "PieSlice"); qmlRegisterUncreatableType(uri, 2, 0, "Legend", QLatin1String("Trying to create uncreatable: Legend.")); qmlRegisterUncreatableType(uri, 2, 0, "XYSeries", QLatin1String("Trying to create uncreatable: XYSeries.")); qmlRegisterUncreatableType(uri, 2, 0, "AbstractItemModel", QLatin1String("Trying to create uncreatable: AbstractItemModel.")); qmlRegisterUncreatableType(uri, 2, 0, "XYModelMapper", QLatin1String("Trying to create uncreatable: XYModelMapper.")); qmlRegisterUncreatableType(uri, 2, 0, "PieModelMapper", QLatin1String("Trying to create uncreatable: PieModelMapper.")); qmlRegisterUncreatableType(uri, 2, 0, "BarModelMapper", QLatin1String("Trying to create uncreatable: BarModelMapper.")); qmlRegisterUncreatableType(uri, 2, 0, "AbstractSeries", QLatin1String("Trying to create uncreatable: AbstractSeries.")); qmlRegisterUncreatableType(uri, 2, 0, "AbstractBarSeries", QLatin1String("Trying to create uncreatable: AbstractBarSeries.")); qmlRegisterUncreatableType(uri, 2, 0, "AbstractAxis", QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead.")); qmlRegisterUncreatableType(uri, 2, 0, "BarSetBase", QLatin1String("Trying to create uncreatable: BarsetBase.")); qmlRegisterUncreatableType(uri, 2, 0, "QPieSeries", QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead.")); qmlRegisterUncreatableType(uri, 2, 0, "DeclarativeAxes", QLatin1String("Trying to create uncreatable: DeclarativeAxes.")); qmlRegisterUncreatableType(uri, 2, 0, "Margins", QLatin1String("Trying to create uncreatable: Margins.")); // QtCharts 2.1 qmlRegisterType(uri, 2, 1, "CategoryAxis"); qmlRegisterUncreatableType(uri, 2, 1, "AbstractAxis", QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead.")); qmlRegisterType(uri, 2, 1, "ChartView"); qmlRegisterType(uri, 2, 1, "ScatterSeries"); qmlRegisterType(uri, 2, 1, "LineSeries"); qmlRegisterType(uri, 2, 1, "SplineSeries"); } }; QT_CHARTS_END_NAMESPACE #include "chartsqml2_plugin.moc" QT_CHARTS_USE_NAMESPACE