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