##// END OF EJS Templates
Bugfix: Define pie model mapper outside series scope
Tero Ahola -
r1926:90966c3904e0
parent child
Show More
@@ -1,153 +1,157
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 26 #include "qdatetimeaxis.h"
27 27 #include "declarativecategoryaxis.h"
28 28 #include "qbarcategoryaxis.h"
29 29 #include "declarativechart.h"
30 30 #include "declarativexypoint.h"
31 31 #include "declarativelineseries.h"
32 32 #include "declarativesplineseries.h"
33 33 #include "declarativeareaseries.h"
34 34 #include "declarativescatterseries.h"
35 35 #include "declarativebarseries.h"
36 36 #include "declarativepieseries.h"
37 37 #include "qvxymodelmapper.h"
38 38 #include "qhxymodelmapper.h"
39 39 #include "qhpiemodelmapper.h"
40 40 #include "qvpiemodelmapper.h"
41 41 #include "qhbarmodelmapper.h"
42 42 #include "qvbarmodelmapper.h"
43 43 #include <QAbstractItemModel>
44 44
45 45 QTCOMMERCIALCHART_BEGIN_NAMESPACE
46 46
47 47 class ChartQmlPlugin : public QDeclarativeExtensionPlugin
48 48 {
49 49 Q_OBJECT
50 50 public:
51 51 virtual void registerTypes(const char *uri)
52 52 {
53 53 Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCommercial.Chart"));
54 54
55 55 // QtCommercial.Chart 1.0
56 56 qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView");
57 57 qmlRegisterType<DeclarativeXYPoint>(uri, 1, 0, "XYPoint");
58 58 qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries");
59 59 qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries");
60 60 qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries");
61 61 qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries");
62 62 qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries");
63 63 qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries");
64 64 qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries");
65 65 qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries");
66 66 qmlRegisterType<QPieSlice>(uri, 1, 0, "PieSlice");
67 67 qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet");
68 68 qmlRegisterType<QHXYModelMapper>(uri, 1, 0, "HXYModelMapper");
69 69 qmlRegisterType<QVXYModelMapper>(uri, 1, 0, "VXYModelMapper");
70 70 qmlRegisterType<QHPieModelMapper>(uri, 1, 0, "HPieModelMapper");
71 71 qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper");
72 72 qmlRegisterType<QHBarModelMapper>(uri, 1, 0, "HBarModelMapper");
73 73 qmlRegisterType<QVBarModelMapper>(uri, 1, 0, "VBarModelMapper");
74 74 qmlRegisterType<QValueAxis>(uri, 1, 0, "ValuesAxis");
75 75 qmlRegisterType<QBarCategoryAxis>(uri, 1, 0, "BarCategoriesAxis");
76 76 qmlRegisterUncreatableType<QLegend>(uri, 1, 0, "Legend",
77 77 QLatin1String("Trying to create uncreatable: Legend."));
78 78 qmlRegisterUncreatableType<QXYSeries>(uri, 1, 0, "XYSeries",
79 79 QLatin1String("Trying to create uncreatable: XYSeries."));
80 80 qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel",
81 81 QLatin1String("Trying to create uncreatable: AbstractItemModel."));
82 82 qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper",
83 83 QLatin1String("Trying to create uncreatable: XYModelMapper."));
84 84 qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper",
85 85 QLatin1String("Trying to create uncreatable: PieModelMapper."));
86 86 qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 0, "BarModelMapper",
87 87 QLatin1String("Trying to create uncreatable: BarModelMapper."));
88 88 qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 0, "AbstractSeries",
89 89 QLatin1String("Trying to create uncreatable: AbstractSeries."));
90 90 qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 1, 0, "AbstractBarSeries",
91 91 QLatin1String("Trying to create uncreatable: AbstractBarSeries."));
92 92 qmlRegisterUncreatableType<QAbstractAxis>(uri, 1, 0, "AbstractAxis",
93 93 QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead."));
94 94 qmlRegisterUncreatableType<QBarSet>(uri, 1, 0, "BarSetBase",
95 95 QLatin1String("Trying to create uncreatable: BarsetBase."));
96 qmlRegisterUncreatableType<QPieSeries>(uri, 1, 0, "QPieSeries",
97 QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead."));
96 98
97 99 // QtCommercial.Chart 1.1
98 100 qmlRegisterType<DeclarativeChart>(uri, 1, 1, "ChartView");
99 101 qmlRegisterType<DeclarativeXYPoint>(uri, 1, 1, "XYPoint");
100 102 qmlRegisterType<DeclarativeScatterSeries, 1>(uri, 1, 1, "ScatterSeries");
101 103 qmlRegisterType<DeclarativeLineSeries, 1>(uri, 1, 1, "LineSeries");
102 104 qmlRegisterType<DeclarativeSplineSeries, 1>(uri, 1, 1, "SplineSeries");
103 105 qmlRegisterType<DeclarativeAreaSeries, 1>(uri, 1, 1, "AreaSeries");
104 106 qmlRegisterType<DeclarativeBarSeries, 1>(uri, 1, 1, "BarSeries");
105 107 qmlRegisterType<DeclarativeStackedBarSeries, 1>(uri, 1, 1, "StackedBarSeries");
106 108 qmlRegisterType<DeclarativePercentBarSeries, 1>(uri, 1, 1, "PercentBarSeries");
107 109 qmlRegisterType<DeclarativeHorizontalBarSeries, 1>(uri, 1, 1, "HorizontalBarSeries");
108 110 qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 1>(uri, 1, 1, "HorizontalStackedBarSeries");
109 111 qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 1>(uri, 1, 1, "HorizontalPercentBarSeries");
110 112 qmlRegisterType<DeclarativePieSeries>(uri, 1, 1, "PieSeries");
111 113 qmlRegisterType<QPieSlice>(uri, 1, 1, "PieSlice");
112 114 qmlRegisterType<DeclarativeBarSet>(uri, 1, 1, "BarSet");
113 115 qmlRegisterType<QHXYModelMapper>(uri, 1, 1, "HXYModelMapper");
114 116 qmlRegisterType<QVXYModelMapper>(uri, 1, 1, "VXYModelMapper");
115 117 qmlRegisterType<QHPieModelMapper>(uri, 1, 1, "HPieModelMapper");
116 118 qmlRegisterType<QVPieModelMapper>(uri, 1, 1, "VPieModelMapper");
117 119 qmlRegisterType<QHBarModelMapper>(uri, 1, 1, "HBarModelMapper");
118 120 qmlRegisterType<QVBarModelMapper>(uri, 1, 1, "VBarModelMapper");
119 121 qmlRegisterType<QValueAxis>(uri, 1, 1, "ValueAxis");
120 122 qmlRegisterType<QDateTimeAxis>(uri, 1, 1, "DateTimeAxis");
121 123 qmlRegisterType<DeclarativeCategoryAxis>(uri, 1, 1, "CategoryAxis");
122 124 qmlRegisterType<DeclarativeCategoryRange>(uri, 1, 1, "CategoryRange");
123 125 qmlRegisterType<QBarCategoryAxis>(uri, 1, 1, "BarCategoryAxis");
124 126 qmlRegisterUncreatableType<QLegend>(uri, 1, 1, "Legend",
125 127 QLatin1String("Trying to create uncreatable: Legend."));
126 128 qmlRegisterUncreatableType<QXYSeries>(uri, 1, 1, "XYSeries",
127 129 QLatin1String("Trying to create uncreatable: XYSeries."));
128 130 qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 1, "AbstractItemModel",
129 131 QLatin1String("Trying to create uncreatable: AbstractItemModel."));
130 132 qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 1, "XYModelMapper",
131 133 QLatin1String("Trying to create uncreatable: XYModelMapper."));
132 134 qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 1, "PieModelMapper",
133 135 QLatin1String("Trying to create uncreatable: PieModelMapper."));
134 136 qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 1, "BarModelMapper",
135 137 QLatin1String("Trying to create uncreatable: BarModelMapper."));
136 138 qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 1, "AbstractSeries",
137 139 QLatin1String("Trying to create uncreatable: AbstractSeries."));
138 140 qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 1, 1, "AbstractBarSeries",
139 141 QLatin1String("Trying to create uncreatable: AbstractBarSeries."));
140 142 qmlRegisterUncreatableType<QAbstractAxis>(uri, 1, 1, "AbstractAxis",
141 143 QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead."));
142 144 qmlRegisterUncreatableType<QBarSet>(uri, 1, 1, "BarSetBase",
143 145 QLatin1String("Trying to create uncreatable: BarsetBase."));
146 qmlRegisterUncreatableType<QPieSeries>(uri, 1, 1, "QPieSeries",
147 QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead."));
144 148 }
145 149 };
146 150
147 151 #include "plugin.moc"
148 152
149 153 QTCOMMERCIALCHART_END_NAMESPACE
150 154
151 155 QTCOMMERCIALCHART_USE_NAMESPACE
152 156
153 157 Q_EXPORT_PLUGIN2(qtcommercialchartqml, QT_PREPEND_NAMESPACE(ChartQmlPlugin))
General Comments 0
You need to be logged in to leave comments. Login now