@@ -1,160 +1,165 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #include <QtDeclarative/qdeclarativeextensionplugin.h> |
|
22 | 22 | #include <QtDeclarative/qdeclarative.h> |
|
23 | 23 | #include "qchart.h" |
|
24 | 24 | #include "qabstractaxis.h" |
|
25 | 25 | #include "qvalueaxis.h" |
|
26 | #include "qdatetimeaxis.h" | |
|
27 | 26 | #include "declarativecategoryaxis.h" |
|
28 | 27 | #include "qbarcategoryaxis.h" |
|
29 | 28 | #include "declarativechart.h" |
|
30 | 29 | #include "declarativexypoint.h" |
|
31 | 30 | #include "declarativelineseries.h" |
|
32 | 31 | #include "declarativesplineseries.h" |
|
33 | 32 | #include "declarativeareaseries.h" |
|
34 | 33 | #include "declarativescatterseries.h" |
|
35 | 34 | #include "declarativebarseries.h" |
|
36 | 35 | #include "declarativepieseries.h" |
|
37 | 36 | #include "qvxymodelmapper.h" |
|
38 | 37 | #include "qhxymodelmapper.h" |
|
39 | 38 | #include "qhpiemodelmapper.h" |
|
40 | 39 | #include "qvpiemodelmapper.h" |
|
41 | 40 | #include "qhbarmodelmapper.h" |
|
42 | 41 | #include "qvbarmodelmapper.h" |
|
43 | 42 | #include "declarativemargins.h" |
|
44 | 43 | #include <QAbstractItemModel> |
|
45 | 44 | |
|
45 | #ifndef QT_ON_ARM | |
|
46 | #include "qdatetimeaxis.h" | |
|
47 | #endif | |
|
48 | ||
|
46 | 49 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
47 | 50 | |
|
48 | 51 | class ChartQmlPlugin : public QDeclarativeExtensionPlugin |
|
49 | 52 | { |
|
50 | 53 | Q_OBJECT |
|
51 | 54 | public: |
|
52 | 55 | virtual void registerTypes(const char *uri) |
|
53 | 56 | { |
|
54 | 57 | Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCommercial.Chart")); |
|
55 | 58 | |
|
56 | 59 | // QtCommercial.Chart 1.0 |
|
57 | 60 | qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView"); |
|
58 | 61 | qmlRegisterType<DeclarativeXYPoint>(uri, 1, 0, "XYPoint"); |
|
59 | 62 | qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries"); |
|
60 | 63 | qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries"); |
|
61 | 64 | qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries"); |
|
62 | 65 | qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries"); |
|
63 | 66 | qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries"); |
|
64 | 67 | qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries"); |
|
65 | 68 | qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries"); |
|
66 | 69 | qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries"); |
|
67 | 70 | qmlRegisterType<QPieSlice>(uri, 1, 0, "PieSlice"); |
|
68 | 71 | qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet"); |
|
69 | 72 | qmlRegisterType<QHXYModelMapper>(uri, 1, 0, "HXYModelMapper"); |
|
70 | 73 | qmlRegisterType<QVXYModelMapper>(uri, 1, 0, "VXYModelMapper"); |
|
71 | 74 | qmlRegisterType<QHPieModelMapper>(uri, 1, 0, "HPieModelMapper"); |
|
72 | 75 | qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper"); |
|
73 | 76 | qmlRegisterType<QHBarModelMapper>(uri, 1, 0, "HBarModelMapper"); |
|
74 | 77 | qmlRegisterType<QVBarModelMapper>(uri, 1, 0, "VBarModelMapper"); |
|
75 | 78 | qmlRegisterType<QValueAxis>(uri, 1, 0, "ValuesAxis"); |
|
76 | 79 | qmlRegisterType<QBarCategoryAxis>(uri, 1, 0, "BarCategoriesAxis"); |
|
77 | 80 | qmlRegisterUncreatableType<QLegend>(uri, 1, 0, "Legend", |
|
78 | 81 | QLatin1String("Trying to create uncreatable: Legend.")); |
|
79 | 82 | qmlRegisterUncreatableType<QXYSeries>(uri, 1, 0, "XYSeries", |
|
80 | 83 | QLatin1String("Trying to create uncreatable: XYSeries.")); |
|
81 | 84 | qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel", |
|
82 | 85 | QLatin1String("Trying to create uncreatable: AbstractItemModel.")); |
|
83 | 86 | qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper", |
|
84 | 87 | QLatin1String("Trying to create uncreatable: XYModelMapper.")); |
|
85 | 88 | qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper", |
|
86 | 89 | QLatin1String("Trying to create uncreatable: PieModelMapper.")); |
|
87 | 90 | qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 0, "BarModelMapper", |
|
88 | 91 | QLatin1String("Trying to create uncreatable: BarModelMapper.")); |
|
89 | 92 | qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 0, "AbstractSeries", |
|
90 | 93 | QLatin1String("Trying to create uncreatable: AbstractSeries.")); |
|
91 | 94 | qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 1, 0, "AbstractBarSeries", |
|
92 | 95 | QLatin1String("Trying to create uncreatable: AbstractBarSeries.")); |
|
93 | 96 | qmlRegisterUncreatableType<QAbstractAxis>(uri, 1, 0, "AbstractAxis", |
|
94 | 97 | QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead.")); |
|
95 | 98 | qmlRegisterUncreatableType<QBarSet>(uri, 1, 0, "BarSetBase", |
|
96 | 99 | QLatin1String("Trying to create uncreatable: BarsetBase.")); |
|
97 | 100 | qmlRegisterUncreatableType<QPieSeries>(uri, 1, 0, "QPieSeries", |
|
98 | 101 | QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead.")); |
|
99 | 102 | |
|
100 | 103 | // QtCommercial.Chart 1.1 |
|
101 | 104 | qmlRegisterType<DeclarativeChart, 1>(uri, 1, 1, "ChartView"); |
|
102 | 105 | qmlRegisterType<DeclarativeXYPoint>(uri, 1, 1, "XYPoint"); |
|
103 | 106 | qmlRegisterType<DeclarativeScatterSeries, 1>(uri, 1, 1, "ScatterSeries"); |
|
104 | 107 | qmlRegisterType<DeclarativeLineSeries, 1>(uri, 1, 1, "LineSeries"); |
|
105 | 108 | qmlRegisterType<DeclarativeSplineSeries, 1>(uri, 1, 1, "SplineSeries"); |
|
106 | 109 | qmlRegisterType<DeclarativeAreaSeries, 1>(uri, 1, 1, "AreaSeries"); |
|
107 | 110 | qmlRegisterType<DeclarativeBarSeries, 1>(uri, 1, 1, "BarSeries"); |
|
108 | 111 | qmlRegisterType<DeclarativeStackedBarSeries, 1>(uri, 1, 1, "StackedBarSeries"); |
|
109 | 112 | qmlRegisterType<DeclarativePercentBarSeries, 1>(uri, 1, 1, "PercentBarSeries"); |
|
110 | 113 | qmlRegisterType<DeclarativeHorizontalBarSeries, 1>(uri, 1, 1, "HorizontalBarSeries"); |
|
111 | 114 | qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 1>(uri, 1, 1, "HorizontalStackedBarSeries"); |
|
112 | 115 | qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 1>(uri, 1, 1, "HorizontalPercentBarSeries"); |
|
113 | 116 | qmlRegisterType<DeclarativePieSeries>(uri, 1, 1, "PieSeries"); |
|
114 | 117 | qmlRegisterType<QPieSlice>(uri, 1, 1, "PieSlice"); |
|
115 | 118 | qmlRegisterType<DeclarativeBarSet>(uri, 1, 1, "BarSet"); |
|
116 | 119 | qmlRegisterType<QHXYModelMapper>(uri, 1, 1, "HXYModelMapper"); |
|
117 | 120 | qmlRegisterType<QVXYModelMapper>(uri, 1, 1, "VXYModelMapper"); |
|
118 | 121 | qmlRegisterType<QHPieModelMapper>(uri, 1, 1, "HPieModelMapper"); |
|
119 | 122 | qmlRegisterType<QVPieModelMapper>(uri, 1, 1, "VPieModelMapper"); |
|
120 | 123 | qmlRegisterType<QHBarModelMapper>(uri, 1, 1, "HBarModelMapper"); |
|
121 | 124 | qmlRegisterType<QVBarModelMapper>(uri, 1, 1, "VBarModelMapper"); |
|
122 | 125 | qmlRegisterType<QValueAxis>(uri, 1, 1, "ValueAxis"); |
|
126 | #ifndef QT_ON_ARM | |
|
123 | 127 | qmlRegisterType<QDateTimeAxis>(uri, 1, 1, "DateTimeAxis"); |
|
128 | #endif | |
|
124 | 129 | qmlRegisterType<DeclarativeCategoryAxis>(uri, 1, 1, "CategoryAxis"); |
|
125 | 130 | qmlRegisterType<DeclarativeCategoryRange>(uri, 1, 1, "CategoryRange"); |
|
126 | 131 | qmlRegisterType<QBarCategoryAxis>(uri, 1, 1, "BarCategoryAxis"); |
|
127 | 132 | qmlRegisterUncreatableType<QLegend>(uri, 1, 1, "Legend", |
|
128 | 133 | QLatin1String("Trying to create uncreatable: Legend.")); |
|
129 | 134 | qmlRegisterUncreatableType<QXYSeries>(uri, 1, 1, "XYSeries", |
|
130 | 135 | QLatin1String("Trying to create uncreatable: XYSeries.")); |
|
131 | 136 | qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 1, "AbstractItemModel", |
|
132 | 137 | QLatin1String("Trying to create uncreatable: AbstractItemModel.")); |
|
133 | 138 | qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 1, "XYModelMapper", |
|
134 | 139 | QLatin1String("Trying to create uncreatable: XYModelMapper.")); |
|
135 | 140 | qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 1, "PieModelMapper", |
|
136 | 141 | QLatin1String("Trying to create uncreatable: PieModelMapper.")); |
|
137 | 142 | qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 1, "BarModelMapper", |
|
138 | 143 | QLatin1String("Trying to create uncreatable: BarModelMapper.")); |
|
139 | 144 | qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 1, "AbstractSeries", |
|
140 | 145 | QLatin1String("Trying to create uncreatable: AbstractSeries.")); |
|
141 | 146 | qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 1, 1, "AbstractBarSeries", |
|
142 | 147 | QLatin1String("Trying to create uncreatable: AbstractBarSeries.")); |
|
143 | 148 | qmlRegisterUncreatableType<QAbstractAxis>(uri, 1, 1, "AbstractAxis", |
|
144 | 149 | QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead.")); |
|
145 | 150 | qmlRegisterUncreatableType<QBarSet>(uri, 1, 1, "BarSetBase", |
|
146 | 151 | QLatin1String("Trying to create uncreatable: BarsetBase.")); |
|
147 | 152 | qmlRegisterUncreatableType<QPieSeries>(uri, 1, 1, "QPieSeries", |
|
148 | 153 | QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead.")); |
|
149 | 154 | qmlRegisterUncreatableType<DeclarativeMargins>(uri, 1, 1, "Margins", |
|
150 | 155 | QLatin1String("Trying to create uncreatable: Margins.")); |
|
151 | 156 | } |
|
152 | 157 | }; |
|
153 | 158 | |
|
154 | 159 | #include "plugin.moc" |
|
155 | 160 | |
|
156 | 161 | QTCOMMERCIALCHART_END_NAMESPACE |
|
157 | 162 | |
|
158 | 163 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
159 | 164 | |
|
160 | 165 | Q_EXPORT_PLUGIN2(qtcommercialchartqml, QT_PREPEND_NAMESPACE(ChartQmlPlugin)) |
General Comments 0
You need to be logged in to leave comments.
Login now