##// END OF EJS Templates
Fix issue with qmloscilloscope in Qt5
Jani Honkonen -
r2250:e351331dbdf9
parent child
Show More
@@ -1,152 +1,153
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 #ifndef QT_ON_ARM
42 42 #include "qdatetimeaxis.h"
43 43 #endif
44 44 #include <QAbstractItemModel>
45 45 #include <QtDeclarative/qdeclarativeextensionplugin.h>
46 46 #include <QtDeclarative/qdeclarative.h>
47 47
48 48 QTCOMMERCIALCHART_USE_NAMESPACE
49 49
50 50 Q_DECLARE_METATYPE(QList<QPieSlice *>)
51 51 Q_DECLARE_METATYPE(QList<QBarSet *>)
52 Q_DECLARE_METATYPE(QAbstractSeries *)
52 53
53 54 QTCOMMERCIALCHART_BEGIN_NAMESPACE
54 55
55 56 class ChartQmlPlugin : public QDeclarativeExtensionPlugin
56 57 {
57 58 Q_OBJECT
58 59
59 60 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
60 61 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface")
61 62 #endif
62 63
63 64 public:
64 65 virtual void registerTypes(const char *uri)
65 66 {
66 67 Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCommercial.Chart"));
67 68
68 69 qRegisterMetaType<QList<QPieSlice *> >();
69 70 qRegisterMetaType<QList<QBarSet *> >();
70 71
71 72 // QtCommercial.Chart 1.0
72 73 qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView");
73 74 qmlRegisterType<DeclarativeXYPoint>(uri, 1, 0, "XYPoint");
74 75 qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries");
75 76 qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries");
76 77 qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries");
77 78 qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries");
78 79 qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries");
79 80 qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries");
80 81 qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries");
81 82 qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries");
82 83 qmlRegisterType<QPieSlice>(uri, 1, 0, "PieSlice");
83 84 qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet");
84 85 qmlRegisterType<QHXYModelMapper>(uri, 1, 0, "HXYModelMapper");
85 86 qmlRegisterType<QVXYModelMapper>(uri, 1, 0, "VXYModelMapper");
86 87 qmlRegisterType<QHPieModelMapper>(uri, 1, 0, "HPieModelMapper");
87 88 qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper");
88 89 qmlRegisterType<QHBarModelMapper>(uri, 1, 0, "HBarModelMapper");
89 90 qmlRegisterType<QVBarModelMapper>(uri, 1, 0, "VBarModelMapper");
90 91 qmlRegisterType<QValueAxis>(uri, 1, 0, "ValuesAxis");
91 92 qmlRegisterType<QBarCategoryAxis>(uri, 1, 0, "BarCategoriesAxis");
92 93 qmlRegisterUncreatableType<QLegend>(uri, 1, 0, "Legend",
93 94 QLatin1String("Trying to create uncreatable: Legend."));
94 95 qmlRegisterUncreatableType<QXYSeries>(uri, 1, 0, "XYSeries",
95 96 QLatin1String("Trying to create uncreatable: XYSeries."));
96 97 qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel",
97 98 QLatin1String("Trying to create uncreatable: AbstractItemModel."));
98 99 qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper",
99 100 QLatin1String("Trying to create uncreatable: XYModelMapper."));
100 101 qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper",
101 102 QLatin1String("Trying to create uncreatable: PieModelMapper."));
102 103 qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 0, "BarModelMapper",
103 104 QLatin1String("Trying to create uncreatable: BarModelMapper."));
104 105 qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 0, "AbstractSeries",
105 106 QLatin1String("Trying to create uncreatable: AbstractSeries."));
106 107 qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 1, 0, "AbstractBarSeries",
107 108 QLatin1String("Trying to create uncreatable: AbstractBarSeries."));
108 109 qmlRegisterUncreatableType<QAbstractAxis>(uri, 1, 0, "AbstractAxis",
109 110 QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead."));
110 111 qmlRegisterUncreatableType<QBarSet>(uri, 1, 0, "BarSetBase",
111 112 QLatin1String("Trying to create uncreatable: BarsetBase."));
112 113 qmlRegisterUncreatableType<QPieSeries>(uri, 1, 0, "QPieSeries",
113 114 QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead."));
114 115
115 116 // QtCommercial.Chart 1.1
116 117 qmlRegisterType<DeclarativeChart, 1>(uri, 1, 1, "ChartView");
117 118 qmlRegisterType<DeclarativeScatterSeries, 1>(uri, 1, 1, "ScatterSeries");
118 119 qmlRegisterType<DeclarativeLineSeries, 1>(uri, 1, 1, "LineSeries");
119 120 qmlRegisterType<DeclarativeSplineSeries, 1>(uri, 1, 1, "SplineSeries");
120 121 qmlRegisterType<DeclarativeAreaSeries, 1>(uri, 1, 1, "AreaSeries");
121 122 qmlRegisterType<DeclarativeBarSeries, 1>(uri, 1, 1, "BarSeries");
122 123 qmlRegisterType<DeclarativeStackedBarSeries, 1>(uri, 1, 1, "StackedBarSeries");
123 124 qmlRegisterType<DeclarativePercentBarSeries, 1>(uri, 1, 1, "PercentBarSeries");
124 125 qmlRegisterType<DeclarativeHorizontalBarSeries, 1>(uri, 1, 1, "HorizontalBarSeries");
125 126 qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 1>(uri, 1, 1, "HorizontalStackedBarSeries");
126 127 qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 1>(uri, 1, 1, "HorizontalPercentBarSeries");
127 128 qmlRegisterType<DeclarativePieSeries>(uri, 1, 1, "PieSeries");
128 129 qmlRegisterType<DeclarativeBarSet>(uri, 1, 1, "BarSet");
129 130 qmlRegisterType<QValueAxis>(uri, 1, 1, "ValueAxis");
130 131 #ifndef QT_ON_ARM
131 132 qmlRegisterType<QDateTimeAxis>(uri, 1, 1, "DateTimeAxis");
132 133 #endif
133 134 qmlRegisterType<DeclarativeCategoryAxis>(uri, 1, 1, "CategoryAxis");
134 135 qmlRegisterType<DeclarativeCategoryRange>(uri, 1, 1, "CategoryRange");
135 136 qmlRegisterType<QBarCategoryAxis>(uri, 1, 1, "BarCategoryAxis");
136 137 qmlRegisterUncreatableType<DeclarativeMargins>(uri, 1, 1, "Margins",
137 138 QLatin1String("Trying to create uncreatable: Margins."));
138 139
139 140 // QtCommercial.Chart 1.2
140 141 qmlRegisterType<DeclarativeChart, 2>(uri, 1, 2, "ChartView");
141 142 }
142 143 };
143 144
144 145 #include "plugin.moc"
145 146
146 147 QTCOMMERCIALCHART_END_NAMESPACE
147 148
148 149 QTCOMMERCIALCHART_USE_NAMESPACE
149 150
150 151 #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
151 152 Q_EXPORT_PLUGIN2(qtcommercialchartqml, QT_PREPEND_NAMESPACE(ChartQmlPlugin))
152 153 #endif
General Comments 0
You need to be logged in to leave comments. Login now