@@ -1,186 +1,189 | |||
|
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 | #ifdef QT5_QUICK_1 |
|
22 | 22 | #include <QtQuick1/qdeclarativeextensionplugin.h> |
|
23 | 23 | #include <QtQuick1/qdeclarative.h> |
|
24 | 24 | #else |
|
25 | 25 | #include <QtDeclarative/qdeclarativeextensionplugin.h> |
|
26 | 26 | #include <QtDeclarative/qdeclarative.h> |
|
27 | 27 | #endif |
|
28 | 28 | #include "qchart.h" |
|
29 | 29 | #include "qabstractaxis.h" |
|
30 | 30 | #include "qvalueaxis.h" |
|
31 | 31 | #include "declarativecategoryaxis.h" |
|
32 | 32 | #include "qbarcategoryaxis.h" |
|
33 | 33 | #include "declarativechart.h" |
|
34 | 34 | #include "declarativexypoint.h" |
|
35 | 35 | #include "declarativelineseries.h" |
|
36 | 36 | #include "declarativesplineseries.h" |
|
37 | 37 | #include "declarativeareaseries.h" |
|
38 | 38 | #include "declarativescatterseries.h" |
|
39 | 39 | #include "declarativebarseries.h" |
|
40 | 40 | #include "declarativepieseries.h" |
|
41 | 41 | #include "qvxymodelmapper.h" |
|
42 | 42 | #include "qhxymodelmapper.h" |
|
43 | 43 | #include "qhpiemodelmapper.h" |
|
44 | 44 | #include "qvpiemodelmapper.h" |
|
45 | 45 | #include "qhbarmodelmapper.h" |
|
46 | 46 | #include "qvbarmodelmapper.h" |
|
47 | 47 | #include "declarativemargins.h" |
|
48 | 48 | #include <QAbstractItemModel> |
|
49 | 49 | |
|
50 | 50 | #ifndef QT_ON_ARM |
|
51 | 51 | #include "qdatetimeaxis.h" |
|
52 | 52 | #endif |
|
53 | 53 | |
|
54 |
QTCOMMERCIALCHART_ |
|
|
54 | QTCOMMERCIALCHART_USE_NAMESPACE | |
|
55 | ||
|
55 | 56 | Q_DECLARE_METATYPE(QList<QPieSlice *>) |
|
56 | 57 | Q_DECLARE_METATYPE(QList<QBarSet *>) |
|
57 | 58 | |
|
59 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
|
60 | ||
|
58 | 61 | class ChartQmlPlugin : public QDeclarativeExtensionPlugin |
|
59 | 62 | { |
|
60 | 63 | Q_OBJECT |
|
61 | 64 | |
|
62 | 65 | #ifdef QT5_QUICK_1 |
|
63 | 66 | // TODO: fix the metadata |
|
64 | 67 | Q_PLUGIN_METADATA(IID "org.qt-project.foo") |
|
65 | 68 | #endif |
|
66 | 69 | |
|
67 | 70 | public: |
|
68 | 71 | virtual void registerTypes(const char *uri) |
|
69 | 72 | { |
|
70 | 73 | Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCommercial.Chart")); |
|
71 | 74 | |
|
72 | 75 | qRegisterMetaType<QList<QPieSlice *> >(); |
|
73 | 76 | qRegisterMetaType<QList<QBarSet *> >(); |
|
74 | 77 | |
|
75 | 78 | // QtCommercial.Chart 1.0 |
|
76 | 79 | qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView"); |
|
77 | 80 | qmlRegisterType<DeclarativeXYPoint>(uri, 1, 0, "XYPoint"); |
|
78 | 81 | qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries"); |
|
79 | 82 | qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries"); |
|
80 | 83 | qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries"); |
|
81 | 84 | qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries"); |
|
82 | 85 | qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries"); |
|
83 | 86 | qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries"); |
|
84 | 87 | qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries"); |
|
85 | 88 | qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries"); |
|
86 | 89 | qmlRegisterType<QPieSlice>(uri, 1, 0, "PieSlice"); |
|
87 | 90 | qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet"); |
|
88 | 91 | qmlRegisterType<QHXYModelMapper>(uri, 1, 0, "HXYModelMapper"); |
|
89 | 92 | qmlRegisterType<QVXYModelMapper>(uri, 1, 0, "VXYModelMapper"); |
|
90 | 93 | qmlRegisterType<QHPieModelMapper>(uri, 1, 0, "HPieModelMapper"); |
|
91 | 94 | qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper"); |
|
92 | 95 | qmlRegisterType<QHBarModelMapper>(uri, 1, 0, "HBarModelMapper"); |
|
93 | 96 | qmlRegisterType<QVBarModelMapper>(uri, 1, 0, "VBarModelMapper"); |
|
94 | 97 | qmlRegisterType<QValueAxis>(uri, 1, 0, "ValuesAxis"); |
|
95 | 98 | qmlRegisterType<QBarCategoryAxis>(uri, 1, 0, "BarCategoriesAxis"); |
|
96 | 99 | qmlRegisterUncreatableType<QLegend>(uri, 1, 0, "Legend", |
|
97 | 100 | QLatin1String("Trying to create uncreatable: Legend.")); |
|
98 | 101 | qmlRegisterUncreatableType<QXYSeries>(uri, 1, 0, "XYSeries", |
|
99 | 102 | QLatin1String("Trying to create uncreatable: XYSeries.")); |
|
100 | 103 | qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel", |
|
101 | 104 | QLatin1String("Trying to create uncreatable: AbstractItemModel.")); |
|
102 | 105 | qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper", |
|
103 | 106 | QLatin1String("Trying to create uncreatable: XYModelMapper.")); |
|
104 | 107 | qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper", |
|
105 | 108 | QLatin1String("Trying to create uncreatable: PieModelMapper.")); |
|
106 | 109 | qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 0, "BarModelMapper", |
|
107 | 110 | QLatin1String("Trying to create uncreatable: BarModelMapper.")); |
|
108 | 111 | qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 0, "AbstractSeries", |
|
109 | 112 | QLatin1String("Trying to create uncreatable: AbstractSeries.")); |
|
110 | 113 | qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 1, 0, "AbstractBarSeries", |
|
111 | 114 | QLatin1String("Trying to create uncreatable: AbstractBarSeries.")); |
|
112 | 115 | qmlRegisterUncreatableType<QAbstractAxis>(uri, 1, 0, "AbstractAxis", |
|
113 | 116 | QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead.")); |
|
114 | 117 | qmlRegisterUncreatableType<QBarSet>(uri, 1, 0, "BarSetBase", |
|
115 | 118 | QLatin1String("Trying to create uncreatable: BarsetBase.")); |
|
116 | 119 | qmlRegisterUncreatableType<QPieSeries>(uri, 1, 0, "QPieSeries", |
|
117 | 120 | QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead.")); |
|
118 | 121 | |
|
119 | 122 | // QtCommercial.Chart 1.1 |
|
120 | 123 | qmlRegisterType<DeclarativeChart, 1>(uri, 1, 1, "ChartView"); |
|
121 | 124 | qmlRegisterType<DeclarativeXYPoint>(uri, 1, 1, "XYPoint"); |
|
122 | 125 | qmlRegisterType<DeclarativeScatterSeries, 1>(uri, 1, 1, "ScatterSeries"); |
|
123 | 126 | qmlRegisterType<DeclarativeLineSeries, 1>(uri, 1, 1, "LineSeries"); |
|
124 | 127 | qmlRegisterType<DeclarativeSplineSeries, 1>(uri, 1, 1, "SplineSeries"); |
|
125 | 128 | qmlRegisterType<DeclarativeAreaSeries, 1>(uri, 1, 1, "AreaSeries"); |
|
126 | 129 | qmlRegisterType<DeclarativeBarSeries, 1>(uri, 1, 1, "BarSeries"); |
|
127 | 130 | qmlRegisterType<DeclarativeStackedBarSeries, 1>(uri, 1, 1, "StackedBarSeries"); |
|
128 | 131 | qmlRegisterType<DeclarativePercentBarSeries, 1>(uri, 1, 1, "PercentBarSeries"); |
|
129 | 132 | qmlRegisterType<DeclarativeHorizontalBarSeries, 1>(uri, 1, 1, "HorizontalBarSeries"); |
|
130 | 133 | qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 1>(uri, 1, 1, "HorizontalStackedBarSeries"); |
|
131 | 134 | qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 1>(uri, 1, 1, "HorizontalPercentBarSeries"); |
|
132 | 135 | qmlRegisterType<DeclarativePieSeries>(uri, 1, 1, "PieSeries"); |
|
133 | 136 | qmlRegisterType<QPieSlice>(uri, 1, 1, "PieSlice"); |
|
134 | 137 | qmlRegisterType<DeclarativeBarSet>(uri, 1, 1, "BarSet"); |
|
135 | 138 | qmlRegisterType<QHXYModelMapper>(uri, 1, 1, "HXYModelMapper"); |
|
136 | 139 | qmlRegisterType<QVXYModelMapper>(uri, 1, 1, "VXYModelMapper"); |
|
137 | 140 | qmlRegisterType<QHPieModelMapper>(uri, 1, 1, "HPieModelMapper"); |
|
138 | 141 | qmlRegisterType<QVPieModelMapper>(uri, 1, 1, "VPieModelMapper"); |
|
139 | 142 | qmlRegisterType<QHBarModelMapper>(uri, 1, 1, "HBarModelMapper"); |
|
140 | 143 | qmlRegisterType<QVBarModelMapper>(uri, 1, 1, "VBarModelMapper"); |
|
141 | 144 | qmlRegisterType<QValueAxis>(uri, 1, 1, "ValueAxis"); |
|
142 | 145 | #ifndef QT_ON_ARM |
|
143 | 146 | qmlRegisterType<QDateTimeAxis>(uri, 1, 1, "DateTimeAxis"); |
|
144 | 147 | #endif |
|
145 | 148 | qmlRegisterType<DeclarativeCategoryAxis>(uri, 1, 1, "CategoryAxis"); |
|
146 | 149 | qmlRegisterType<DeclarativeCategoryRange>(uri, 1, 1, "CategoryRange"); |
|
147 | 150 | qmlRegisterType<QBarCategoryAxis>(uri, 1, 1, "BarCategoryAxis"); |
|
148 | 151 | qmlRegisterUncreatableType<QLegend>(uri, 1, 1, "Legend", |
|
149 | 152 | QLatin1String("Trying to create uncreatable: Legend.")); |
|
150 | 153 | qmlRegisterUncreatableType<QXYSeries>(uri, 1, 1, "XYSeries", |
|
151 | 154 | QLatin1String("Trying to create uncreatable: XYSeries.")); |
|
152 | 155 | qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 1, "AbstractItemModel", |
|
153 | 156 | QLatin1String("Trying to create uncreatable: AbstractItemModel.")); |
|
154 | 157 | qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 1, "XYModelMapper", |
|
155 | 158 | QLatin1String("Trying to create uncreatable: XYModelMapper.")); |
|
156 | 159 | qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 1, "PieModelMapper", |
|
157 | 160 | QLatin1String("Trying to create uncreatable: PieModelMapper.")); |
|
158 | 161 | qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 1, "BarModelMapper", |
|
159 | 162 | QLatin1String("Trying to create uncreatable: BarModelMapper.")); |
|
160 | 163 | qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 1, "AbstractSeries", |
|
161 | 164 | QLatin1String("Trying to create uncreatable: AbstractSeries.")); |
|
162 | 165 | qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 1, 1, "AbstractBarSeries", |
|
163 | 166 | QLatin1String("Trying to create uncreatable: AbstractBarSeries.")); |
|
164 | 167 | qmlRegisterUncreatableType<QAbstractAxis>(uri, 1, 1, "AbstractAxis", |
|
165 | 168 | QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead.")); |
|
166 | 169 | qmlRegisterUncreatableType<QBarSet>(uri, 1, 1, "BarSetBase", |
|
167 | 170 | QLatin1String("Trying to create uncreatable: BarsetBase.")); |
|
168 | 171 | qmlRegisterUncreatableType<QPieSeries>(uri, 1, 1, "QPieSeries", |
|
169 | 172 | QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead.")); |
|
170 | 173 | qmlRegisterUncreatableType<DeclarativeMargins>(uri, 1, 1, "Margins", |
|
171 | 174 | QLatin1String("Trying to create uncreatable: Margins.")); |
|
172 | 175 | |
|
173 | 176 | // QtCommercial.Chart 1.2 |
|
174 | 177 | qmlRegisterType<DeclarativeChart, 2>(uri, 1, 2, "ChartView"); |
|
175 | 178 | } |
|
176 | 179 | }; |
|
177 | 180 | |
|
178 | 181 | #include "plugin.moc" |
|
179 | 182 | |
|
180 | 183 | QTCOMMERCIALCHART_END_NAMESPACE |
|
181 | 184 | |
|
182 | 185 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
183 | 186 | |
|
184 | 187 | #ifndef QT5_QUICK_1 |
|
185 | 188 | Q_EXPORT_PLUGIN2(qtcommercialchartqml, QT_PREPEND_NAMESPACE(ChartQmlPlugin)) |
|
186 | 189 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now