plugin.cpp
165 lines
| 9.8 KiB
| text/x-c
|
CppLexer
|
r830 | /**************************************************************************** | ||
** | ||||
** Copyright (C) 2012 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 Commercial Charts Add-on. | ||||
** | ||||
** $QT_BEGIN_LICENSE$ | ||||
** Licensees holding valid Qt Commercial licenses may use this file in | ||||
** accordance with the Qt Commercial 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$ | ||||
** | ||||
****************************************************************************/ | ||||
|
r1 | #include <QtDeclarative/qdeclarativeextensionplugin.h> | ||
#include <QtDeclarative/qdeclarative.h> | ||||
|
r836 | #include "qchart.h" | ||
|
r1541 | #include "qabstractaxis.h" | ||
|
r1805 | #include "qvalueaxis.h" | ||
|
r1870 | #include "declarativecategoryaxis.h" | ||
|
r1810 | #include "qbarcategoryaxis.h" | ||
|
r1 | #include "declarativechart.h" | ||
|
r722 | #include "declarativexypoint.h" | ||
|
r215 | #include "declarativelineseries.h" | ||
|
r732 | #include "declarativesplineseries.h" | ||
|
r847 | #include "declarativeareaseries.h" | ||
|
r732 | #include "declarativescatterseries.h" | ||
|
r646 | #include "declarativebarseries.h" | ||
|
r215 | #include "declarativepieseries.h" | ||
|
r1669 | #include "qvxymodelmapper.h" | ||
#include "qhxymodelmapper.h" | ||||
#include "qhpiemodelmapper.h" | ||||
#include "qvpiemodelmapper.h" | ||||
#include "qhbarmodelmapper.h" | ||||
#include "qvbarmodelmapper.h" | ||||
|
r1928 | #include "declarativemargins.h" | ||
|
r1669 | #include <QAbstractItemModel> | ||
|
r1 | |||
|
r1942 | #ifndef QT_ON_ARM | ||
#include "qdatetimeaxis.h" | ||||
#endif | ||||
|
r120 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||
|
r1 | |||
|
r120 | class ChartQmlPlugin : public QDeclarativeExtensionPlugin | ||
|
r1 | { | ||
Q_OBJECT | ||||
|
r1942 | public: | ||
|
r1 | virtual void registerTypes(const char *uri) | ||
{ | ||||
|
r120 | Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCommercial.Chart")); | ||
|
r215 | |||
|
r1857 | // QtCommercial.Chart 1.0 | ||
|
r1130 | qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView"); | ||
|
r1532 | qmlRegisterType<DeclarativeXYPoint>(uri, 1, 0, "XYPoint"); | ||
|
r196 | qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries"); | ||
|
r215 | qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries"); | ||
|
r732 | qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries"); | ||
|
r847 | qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries"); | ||
|
r1594 | qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries"); | ||
|
r1318 | qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries"); | ||
qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries"); | ||||
|
r215 | qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries"); | ||
|
r1329 | qmlRegisterType<QPieSlice>(uri, 1, 0, "PieSlice"); | ||
|
r1240 | qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet"); | ||
|
r1278 | qmlRegisterType<QHXYModelMapper>(uri, 1, 0, "HXYModelMapper"); | ||
qmlRegisterType<QVXYModelMapper>(uri, 1, 0, "VXYModelMapper"); | ||||
qmlRegisterType<QHPieModelMapper>(uri, 1, 0, "HPieModelMapper"); | ||||
qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper"); | ||||
|
r1313 | qmlRegisterType<QHBarModelMapper>(uri, 1, 0, "HBarModelMapper"); | ||
qmlRegisterType<QVBarModelMapper>(uri, 1, 0, "VBarModelMapper"); | ||||
|
r1857 | qmlRegisterType<QValueAxis>(uri, 1, 0, "ValuesAxis"); | ||
|
r1808 | qmlRegisterType<QBarCategoryAxis>(uri, 1, 0, "BarCategoriesAxis"); | ||
|
r1357 | qmlRegisterUncreatableType<QLegend>(uri, 1, 0, "Legend", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: Legend.")); | ||
|
r1491 | qmlRegisterUncreatableType<QXYSeries>(uri, 1, 0, "XYSeries", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: XYSeries.")); | ||
|
r1249 | qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: AbstractItemModel.")); | ||
|
r1278 | qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: XYModelMapper.")); | ||
|
r1249 | qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: PieModelMapper.")); | ||
|
r1313 | qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 0, "BarModelMapper", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: BarModelMapper.")); | ||
|
r1240 | qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 0, "AbstractSeries", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: AbstractSeries.")); | ||
|
r1604 | qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 1, 0, "AbstractBarSeries", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: AbstractBarSeries.")); | ||
|
r1550 | qmlRegisterUncreatableType<QAbstractAxis>(uri, 1, 0, "AbstractAxis", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead.")); | ||
|
r1908 | qmlRegisterUncreatableType<QBarSet>(uri, 1, 0, "BarSetBase", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: BarsetBase.")); | ||
|
r1926 | qmlRegisterUncreatableType<QPieSeries>(uri, 1, 0, "QPieSeries", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead.")); | ||
|
r1857 | |||
// QtCommercial.Chart 1.1 | ||||
|
r1928 | qmlRegisterType<DeclarativeChart, 1>(uri, 1, 1, "ChartView"); | ||
|
r1857 | qmlRegisterType<DeclarativeXYPoint>(uri, 1, 1, "XYPoint"); | ||
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<QPieSlice>(uri, 1, 1, "PieSlice"); | ||||
qmlRegisterType<DeclarativeBarSet>(uri, 1, 1, "BarSet"); | ||||
qmlRegisterType<QHXYModelMapper>(uri, 1, 1, "HXYModelMapper"); | ||||
qmlRegisterType<QVXYModelMapper>(uri, 1, 1, "VXYModelMapper"); | ||||
qmlRegisterType<QHPieModelMapper>(uri, 1, 1, "HPieModelMapper"); | ||||
qmlRegisterType<QVPieModelMapper>(uri, 1, 1, "VPieModelMapper"); | ||||
qmlRegisterType<QHBarModelMapper>(uri, 1, 1, "HBarModelMapper"); | ||||
qmlRegisterType<QVBarModelMapper>(uri, 1, 1, "VBarModelMapper"); | ||||
qmlRegisterType<QValueAxis>(uri, 1, 1, "ValueAxis"); | ||||
|
r1942 | #ifndef QT_ON_ARM | ||
|
r1870 | qmlRegisterType<QDateTimeAxis>(uri, 1, 1, "DateTimeAxis"); | ||
|
r1942 | #endif | ||
|
r1870 | qmlRegisterType<DeclarativeCategoryAxis>(uri, 1, 1, "CategoryAxis"); | ||
qmlRegisterType<DeclarativeCategoryRange>(uri, 1, 1, "CategoryRange"); | ||||
|
r1857 | qmlRegisterType<QBarCategoryAxis>(uri, 1, 1, "BarCategoryAxis"); | ||
qmlRegisterUncreatableType<QLegend>(uri, 1, 1, "Legend", | ||||
|
r1942 | QLatin1String("Trying to create uncreatable: Legend.")); | ||
|
r1857 | qmlRegisterUncreatableType<QXYSeries>(uri, 1, 1, "XYSeries", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: XYSeries.")); | ||
|
r1857 | qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 1, "AbstractItemModel", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: AbstractItemModel.")); | ||
|
r1857 | qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 1, "XYModelMapper", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: XYModelMapper.")); | ||
|
r1857 | qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 1, "PieModelMapper", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: PieModelMapper.")); | ||
|
r1857 | qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 1, "BarModelMapper", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: BarModelMapper.")); | ||
|
r1857 | qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 1, "AbstractSeries", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: AbstractSeries.")); | ||
|
r1857 | qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 1, 1, "AbstractBarSeries", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: AbstractBarSeries.")); | ||
|
r1857 | qmlRegisterUncreatableType<QAbstractAxis>(uri, 1, 1, "AbstractAxis", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead.")); | ||
|
r1908 | qmlRegisterUncreatableType<QBarSet>(uri, 1, 1, "BarSetBase", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: BarsetBase.")); | ||
|
r1926 | qmlRegisterUncreatableType<QPieSeries>(uri, 1, 1, "QPieSeries", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead.")); | ||
|
r1928 | qmlRegisterUncreatableType<DeclarativeMargins>(uri, 1, 1, "Margins", | ||
|
r1942 | QLatin1String("Trying to create uncreatable: Margins.")); | ||
|
r1 | } | ||
}; | ||||
#include "plugin.moc" | ||||
|
r120 | QTCOMMERCIALCHART_END_NAMESPACE | ||
QTCOMMERCIALCHART_USE_NAMESPACE | ||||
Q_EXPORT_PLUGIN2(qtcommercialchartqml, QT_PREPEND_NAMESPACE(ChartQmlPlugin)) | ||||