##// END OF EJS Templates
Fix Qt4 builds
Jani Honkonen -
r2260:299adba9c9cb
parent child
Show More
@@ -1,213 +1,215
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 "qchart.h"
22 22 #include "qabstractaxis.h"
23 23 #include "qvalueaxis.h"
24 24 #include "declarativecategoryaxis.h"
25 25 #include "qbarcategoryaxis.h"
26 26 #include "declarativechart.h"
27 27 #include "declarativexypoint.h"
28 28 #include "declarativelineseries.h"
29 29 #include "declarativesplineseries.h"
30 30 #include "declarativeareaseries.h"
31 31 #include "declarativescatterseries.h"
32 32 #include "declarativebarseries.h"
33 33 #include "declarativepieseries.h"
34 34 #include "qvxymodelmapper.h"
35 35 #include "qhxymodelmapper.h"
36 36 #include "qhpiemodelmapper.h"
37 37 #include "qvpiemodelmapper.h"
38 38 #include "qhbarmodelmapper.h"
39 39 #include "qvbarmodelmapper.h"
40 40 #include "declarativemargins.h"
41 41 #include "qarealegendmarker.h"
42 42 #include "qbarlegendmarker.h"
43 43 #include "qpielegendmarker.h"
44 44 #include "qxylegendmarker.h"
45 45 #ifndef QT_ON_ARM
46 46 #include "qdatetimeaxis.h"
47 47 #endif
48 48 #include <QAbstractItemModel>
49 49 #include <QtDeclarative/qdeclarativeextensionplugin.h>
50 50 #include <QtDeclarative/qdeclarative.h>
51 51
52 52 QTCOMMERCIALCHART_USE_NAMESPACE
53 53
54 54 Q_DECLARE_METATYPE(QList<QPieSlice *>)
55 55 Q_DECLARE_METATYPE(QList<QBarSet *>)
56 56
57 57 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
58 58
59 59 // NOTE: Hackish fixes for Qt5 (beta2).
60 60 // These should not be needed or at least they are not needed in Qt4.
61 61
62 62 Q_DECLARE_METATYPE(DeclarativeChart::SeriesType)
63 63 Q_DECLARE_METATYPE(DeclarativeMargins *)
64 64 Q_DECLARE_METATYPE(DeclarativeAreaSeries *)
65 65 Q_DECLARE_METATYPE(DeclarativeBarSeries *)
66 66 Q_DECLARE_METATYPE(DeclarativeLineSeries *)
67 67 Q_DECLARE_METATYPE(DeclarativePieSeries *)
68 68 Q_DECLARE_METATYPE(DeclarativeScatterSeries *)
69 69 Q_DECLARE_METATYPE(DeclarativeSplineSeries *)
70 70
71 71 Q_DECLARE_METATYPE(QAbstractAxis *)
72 72 Q_DECLARE_METATYPE(QValueAxis *)
73 73 Q_DECLARE_METATYPE(QBarCategoryAxis *)
74 74 Q_DECLARE_METATYPE(QCategoryAxis *)
75 75 Q_DECLARE_METATYPE(QDateTimeAxis *)
76 76
77 77 Q_DECLARE_METATYPE(QLegend *)
78 78 Q_DECLARE_METATYPE(QLegendMarker *)
79 79 Q_DECLARE_METATYPE(QAreaLegendMarker *)
80 80 Q_DECLARE_METATYPE(QBarLegendMarker *)
81 81 Q_DECLARE_METATYPE(QPieLegendMarker *)
82 82
83 83 Q_DECLARE_METATYPE(QHPieModelMapper *)
84 84 Q_DECLARE_METATYPE(QHXYModelMapper *)
85 85 Q_DECLARE_METATYPE(QPieModelMapper *)
86 86 Q_DECLARE_METATYPE(QHBarModelMapper *)
87 87 Q_DECLARE_METATYPE(QBarModelMapper *)
88 88 Q_DECLARE_METATYPE(QVBarModelMapper *)
89 89 Q_DECLARE_METATYPE(QVPieModelMapper *)
90 90 Q_DECLARE_METATYPE(QVXYModelMapper *)
91 91 Q_DECLARE_METATYPE(QXYLegendMarker *)
92 92 Q_DECLARE_METATYPE(QXYModelMapper *)
93 93
94 94 Q_DECLARE_METATYPE(QAbstractSeries *)
95 95 Q_DECLARE_METATYPE(QXYSeries *)
96 96 Q_DECLARE_METATYPE(QAbstractBarSeries *)
97 97 Q_DECLARE_METATYPE(QBarSeries *)
98 98 Q_DECLARE_METATYPE(QBarSet *)
99 99 Q_DECLARE_METATYPE(QAreaSeries *)
100 100 Q_DECLARE_METATYPE(QHorizontalBarSeries *)
101 101 Q_DECLARE_METATYPE(QHorizontalPercentBarSeries *)
102 102 Q_DECLARE_METATYPE(QHorizontalStackedBarSeries *)
103 103 Q_DECLARE_METATYPE(QLineSeries *)
104 104 Q_DECLARE_METATYPE(QPercentBarSeries *)
105 105 Q_DECLARE_METATYPE(QPieSeries *)
106 106 Q_DECLARE_METATYPE(QPieSlice *)
107 107 Q_DECLARE_METATYPE(QScatterSeries *)
108 108 Q_DECLARE_METATYPE(QSplineSeries *)
109 109 Q_DECLARE_METATYPE(QStackedBarSeries *)
110 110
111 111 #endif
112 112
113 113 QTCOMMERCIALCHART_BEGIN_NAMESPACE
114 114
115 115 class ChartQmlPlugin : public QDeclarativeExtensionPlugin
116 116 {
117 117 Q_OBJECT
118 118
119 119 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
120 120 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface")
121 121 #endif
122 122
123 123 public:
124 124 virtual void registerTypes(const char *uri)
125 125 {
126 126 Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCommercial.Chart"));
127 127
128 128 qRegisterMetaType<QList<QPieSlice *> >();
129 129 qRegisterMetaType<QList<QBarSet *> >();
130 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
130 131 qRegisterMetaType<DeclarativeChart::SeriesType>();
132 #endif
131 133
132 134 // QtCommercial.Chart 1.0
133 135 qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView");
134 136 qmlRegisterType<DeclarativeXYPoint>(uri, 1, 0, "XYPoint");
135 137 qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries");
136 138 qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries");
137 139 qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries");
138 140 qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries");
139 141 qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries");
140 142 qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries");
141 143 qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries");
142 144 qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries");
143 145 qmlRegisterType<QPieSlice>(uri, 1, 0, "PieSlice");
144 146 qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet");
145 147 qmlRegisterType<QHXYModelMapper>(uri, 1, 0, "HXYModelMapper");
146 148 qmlRegisterType<QVXYModelMapper>(uri, 1, 0, "VXYModelMapper");
147 149 qmlRegisterType<QHPieModelMapper>(uri, 1, 0, "HPieModelMapper");
148 150 qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper");
149 151 qmlRegisterType<QHBarModelMapper>(uri, 1, 0, "HBarModelMapper");
150 152 qmlRegisterType<QVBarModelMapper>(uri, 1, 0, "VBarModelMapper");
151 153 qmlRegisterType<QValueAxis>(uri, 1, 0, "ValuesAxis");
152 154 qmlRegisterType<QBarCategoryAxis>(uri, 1, 0, "BarCategoriesAxis");
153 155 qmlRegisterUncreatableType<QLegend>(uri, 1, 0, "Legend",
154 156 QLatin1String("Trying to create uncreatable: Legend."));
155 157 qmlRegisterUncreatableType<QXYSeries>(uri, 1, 0, "XYSeries",
156 158 QLatin1String("Trying to create uncreatable: XYSeries."));
157 159 qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel",
158 160 QLatin1String("Trying to create uncreatable: AbstractItemModel."));
159 161 qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper",
160 162 QLatin1String("Trying to create uncreatable: XYModelMapper."));
161 163 qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper",
162 164 QLatin1String("Trying to create uncreatable: PieModelMapper."));
163 165 qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 0, "BarModelMapper",
164 166 QLatin1String("Trying to create uncreatable: BarModelMapper."));
165 167 qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 0, "AbstractSeries",
166 168 QLatin1String("Trying to create uncreatable: AbstractSeries."));
167 169 qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 1, 0, "AbstractBarSeries",
168 170 QLatin1String("Trying to create uncreatable: AbstractBarSeries."));
169 171 qmlRegisterUncreatableType<QAbstractAxis>(uri, 1, 0, "AbstractAxis",
170 172 QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead."));
171 173 qmlRegisterUncreatableType<QBarSet>(uri, 1, 0, "BarSetBase",
172 174 QLatin1String("Trying to create uncreatable: BarsetBase."));
173 175 qmlRegisterUncreatableType<QPieSeries>(uri, 1, 0, "QPieSeries",
174 176 QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead."));
175 177
176 178 // QtCommercial.Chart 1.1
177 179 qmlRegisterType<DeclarativeChart, 1>(uri, 1, 1, "ChartView");
178 180 qmlRegisterType<DeclarativeScatterSeries, 1>(uri, 1, 1, "ScatterSeries");
179 181 qmlRegisterType<DeclarativeLineSeries, 1>(uri, 1, 1, "LineSeries");
180 182 qmlRegisterType<DeclarativeSplineSeries, 1>(uri, 1, 1, "SplineSeries");
181 183 qmlRegisterType<DeclarativeAreaSeries, 1>(uri, 1, 1, "AreaSeries");
182 184 qmlRegisterType<DeclarativeBarSeries, 1>(uri, 1, 1, "BarSeries");
183 185 qmlRegisterType<DeclarativeStackedBarSeries, 1>(uri, 1, 1, "StackedBarSeries");
184 186 qmlRegisterType<DeclarativePercentBarSeries, 1>(uri, 1, 1, "PercentBarSeries");
185 187 qmlRegisterType<DeclarativeHorizontalBarSeries, 1>(uri, 1, 1, "HorizontalBarSeries");
186 188 qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 1>(uri, 1, 1, "HorizontalStackedBarSeries");
187 189 qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 1>(uri, 1, 1, "HorizontalPercentBarSeries");
188 190 qmlRegisterType<DeclarativePieSeries>(uri, 1, 1, "PieSeries");
189 191 qmlRegisterType<DeclarativeBarSet>(uri, 1, 1, "BarSet");
190 192 qmlRegisterType<QValueAxis>(uri, 1, 1, "ValueAxis");
191 193 #ifndef QT_ON_ARM
192 194 qmlRegisterType<QDateTimeAxis>(uri, 1, 1, "DateTimeAxis");
193 195 #endif
194 196 qmlRegisterType<DeclarativeCategoryAxis>(uri, 1, 1, "CategoryAxis");
195 197 qmlRegisterType<DeclarativeCategoryRange>(uri, 1, 1, "CategoryRange");
196 198 qmlRegisterType<QBarCategoryAxis>(uri, 1, 1, "BarCategoryAxis");
197 199 qmlRegisterUncreatableType<DeclarativeMargins>(uri, 1, 1, "Margins",
198 200 QLatin1String("Trying to create uncreatable: Margins."));
199 201
200 202 // QtCommercial.Chart 1.2
201 203 qmlRegisterType<DeclarativeChart, 2>(uri, 1, 2, "ChartView");
202 204 }
203 205 };
204 206
205 207 #include "plugin.moc"
206 208
207 209 QTCOMMERCIALCHART_END_NAMESPACE
208 210
209 211 QTCOMMERCIALCHART_USE_NAMESPACE
210 212
211 213 #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
212 214 Q_EXPORT_PLUGIN2(qtcommercialchartqml, QT_PREPEND_NAMESPACE(ChartQmlPlugin))
213 215 #endif
General Comments 0
You need to be logged in to leave comments. Login now