1 /****************************************************************************
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the QtDeclarative module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #include "QtQuick1/private/qdeclarativeitemsmodule_p.h"
44 #include <QtWidgets/qaction.h>
45 #include <QtGui/qvalidator.h>
46 #include <QtWidgets/qgraphicseffect.h>
47 #include <QtWidgets/qgraphicsitem.h>
49 #include "QtQuick1/private/qdeclarativeevents_p_p.h"
50 #include "QtQuick1/private/qdeclarativescalegrid_p_p.h"
51 #include "QtQuick1/private/qdeclarativeanimatedimage_p.h"
52 #include "QtQuick1/private/qdeclarativeborderimage_p.h"
53 #include "QtQuick1/private/qdeclarativepositioners_p.h"
54 #include "QtQuick1/private/qdeclarativemousearea_p.h"
55 #include "QtQuick1/private/qdeclarativeflickable_p.h"
56 #include "QtQuick1/private/qdeclarativeflickable_p_p.h"
57 #include "QtQuick1/private/qdeclarativeflipable_p.h"
58 #include "QtQuick1/private/qdeclarativefocuspanel_p.h"
59 #include "QtQuick1/private/qdeclarativefocusscope_p.h"
60 #include "QtQuick1/private/qdeclarativegridview_p.h"
61 #include "QtQuick1/private/qdeclarativeimage_p.h"
62 #include "QtQuick1/private/qdeclarativeitem_p.h"
63 #include "QtQuick1/private/qdeclarativelayoutitem_p.h"
64 #include "QtQuick1/private/qdeclarativelistview_p.h"
65 #include "QtQuick1/private/qdeclarativeloader_p.h"
66 #include "QtQuick1/private/qdeclarativemousearea_p.h"
67 #include "QtQuick1/private/qdeclarativepath_p.h"
68 #include "QtQuick1/private/qdeclarativepathview_p.h"
69 #include "QtQuick1/private/qdeclarativerectangle_p.h"
70 #include "QtQuick1/private/qdeclarativerepeater_p.h"
71 #include "QtQuick1/private/qdeclarativetranslate_p.h"
72 #include "QtQuick1/private/qdeclarativetext_p.h"
73 #include "QtQuick1/private/qdeclarativetextedit_p.h"
74 #include "QtQuick1/private/qdeclarativetextinput_p.h"
75 #include "QtQuick1/private/qdeclarativevisualitemmodel_p.h"
76 #include "QtQuick1/private/qdeclarativegraphicswidget_p.h"
77 #include "QtQuick1/private/qdeclarativeanchors_p.h"
78 #include "QtQuick1/private/qdeclarativepincharea_p.h"
80 static QDeclarativePrivate::AutoParentResult qgraphicsobject_autoParent(QObject *obj, QObject *parent)
82 QGraphicsObject* gobj = qobject_cast<QGraphicsObject*>(obj);
84 return QDeclarativePrivate::IncompatibleObject;
86 QGraphicsObject* gparent = qobject_cast<QGraphicsObject*>(parent);
88 return QDeclarativePrivate::IncompatibleParent;
90 gobj->setParentItem(gparent);
91 return QDeclarativePrivate::Parented;
94 void QDeclarative1ItemModule::defineModule(QDeclarativeQtQuick1Module::Module module)
96 QDeclarativePrivate::RegisterAutoParent autoparent = { 0, &qgraphicsobject_autoParent };
97 QDeclarativePrivate::qmlregister(QDeclarativePrivate::AutoParentRegistration, &autoparent);
99 qmlRegisterType<QDeclarative1Anchors>();
100 qmlRegisterType<QDeclarative1KeyEvent>();
101 qmlRegisterType<QDeclarative1MouseEvent>();
102 qmlRegisterType<QGraphicsObject>();
103 qmlRegisterType<QGraphicsTransform>();
104 qmlRegisterType<QDeclarative1PathElement>();
105 qmlRegisterType<QDeclarative1Curve>();
106 qmlRegisterType<QDeclarative1ScaleGrid>();
107 #ifndef QT_NO_VALIDATOR
108 qmlRegisterType<QValidator>();
110 qmlRegisterType<QDeclarative1VisualModel>();
112 qmlRegisterType<QAction>();
114 qmlRegisterType<QDeclarative1Pen>();
115 qmlRegisterType<QDeclarative1FlickableVisibleArea>();
116 #ifndef QT_NO_GRAPHICSEFFECT
117 qmlRegisterType<QGraphicsEffect>();
120 if (module == QDeclarativeQtQuick1Module::QtQuick1) {
122 qmlRegisterTypeNotAvailable("QtQuick",1,0,"AnimatedImage",
123 qApp->translate("QDeclarative1AnimatedImage","Qt was built without support for QMovie"));
125 qmlRegisterType<QDeclarative1AnimatedImage>("QtQuick",1,0,"AnimatedImage");
127 qmlRegisterType<QDeclarative1BorderImage>("QtQuick",1,0,"BorderImage");
128 qmlRegisterType<QDeclarative1Column>("QtQuick",1,0,"Column");
129 qmlRegisterType<QDeclarative1Drag>("QtQuick",1,0,"Drag");
130 qmlRegisterType<QDeclarative1Flickable>("QtQuick",1,0,"Flickable");
131 qmlRegisterType<QDeclarative1Flipable>("QtQuick",1,0,"Flipable");
132 qmlRegisterType<QDeclarative1Flow>("QtQuick",1,0,"Flow");
133 qmlRegisterType<QDeclarative1FocusPanel>("QtQuick",1,0,"FocusPanel");
134 qmlRegisterType<QDeclarative1FocusScope>("QtQuick",1,0,"FocusScope");
135 qmlRegisterType<QDeclarative1Gradient>("QtQuick",1,0,"Gradient");
136 qmlRegisterType<QDeclarative1GradientStop>("QtQuick",1,0,"GradientStop");
137 qmlRegisterType<QDeclarative1Grid>("QtQuick",1,0,"Grid");
138 qmlRegisterType<QDeclarative1GridView>("QtQuick",1,0,"GridView");
139 qmlRegisterType<QDeclarative1Image>("QtQuick",1,0,"Image");
140 qmlRegisterType<QDeclarativeItem>("QtQuick",1,0,"Item");
141 qmlRegisterType<QDeclarative1LayoutItem>("QtQuick",1,0,"LayoutItem");
142 qmlRegisterType<QDeclarative1ListView>("QtQuick",1,0,"ListView");
143 qmlRegisterType<QDeclarative1Loader>("QtQuick",1,0,"Loader");
144 qmlRegisterType<QDeclarative1MouseArea>("QtQuick",1,0,"MouseArea");
145 qmlRegisterType<QDeclarative1Path>("QtQuick",1,0,"Path");
146 qmlRegisterType<QDeclarative1PathAttribute>("QtQuick",1,0,"PathAttribute");
147 qmlRegisterType<QDeclarative1PathCubic>("QtQuick",1,0,"PathCubic");
148 qmlRegisterType<QDeclarative1PathLine>("QtQuick",1,0,"PathLine");
149 qmlRegisterType<QDeclarative1PathPercent>("QtQuick",1,0,"PathPercent");
150 qmlRegisterType<QDeclarative1PathQuad>("QtQuick",1,0,"PathQuad");
151 qmlRegisterType<QDeclarative1PathView>("QtQuick",1,0,"PathView");
152 #ifndef QT_NO_VALIDATOR
153 qmlRegisterType<QIntValidator>("QtQuick",1,0,"IntValidator");
154 qmlRegisterType<QDoubleValidator>("QtQuick",1,0,"DoubleValidator");
155 qmlRegisterType<QRegExpValidator>("QtQuick",1,0,"RegExpValidator");
157 qmlRegisterType<QDeclarative1Rectangle>("QtQuick",1,0,"Rectangle");
158 qmlRegisterType<QDeclarative1Repeater>("QtQuick",1,0,"Repeater");
159 qmlRegisterType<QGraphicsRotation>("QtQuick",1,0,"Rotation");
160 qmlRegisterType<QDeclarative1Row>("QtQuick",1,0,"Row");
161 qmlRegisterType<QDeclarative1Translate>("QtQuick",1,0,"Translate");
162 qmlRegisterType<QGraphicsScale>("QtQuick",1,0,"Scale");
163 qmlRegisterType<QDeclarative1Text>("QtQuick",1,0,"Text");
164 qmlRegisterType<QDeclarative1TextEdit>("QtQuick",1,0,"TextEdit");
165 #ifndef QT_NO_LINEEDIT
166 qmlRegisterType<QDeclarative1TextInput>("QtQuick",1,0,"TextInput");
168 qmlRegisterType<QDeclarative1ViewSection>("QtQuick",1,0,"ViewSection");
169 qmlRegisterType<QDeclarative1VisualDataModel>("QtQuick",1,0,"VisualDataModel");
170 qmlRegisterType<QDeclarative1VisualItemModel>("QtQuick",1,0,"VisualItemModel");
172 qmlRegisterType<QGraphicsWidget>("QtQuick",1,0,"QGraphicsWidget");
173 qmlRegisterExtendedType<QGraphicsWidget,QDeclarative1GraphicsWidget>("QtQuick",1,0,"QGraphicsWidget");
175 qmlRegisterUncreatableType<QDeclarative1KeyNavigationAttached>("QtQuick",1,0,"KeyNavigation",QDeclarative1KeyNavigationAttached::tr("KeyNavigation is only available via attached properties"));
176 qmlRegisterUncreatableType<QDeclarative1KeysAttached>("QtQuick",1,0,"Keys",QDeclarative1KeysAttached::tr("Keys is only available via attached properties"));
179 qmlRegisterType<QDeclarative1PinchArea>("QtQuick",1,1,"PinchArea");
180 qmlRegisterType<QDeclarative1Pinch>("QtQuick",1,1,"Pinch");
181 qmlRegisterType<QDeclarative1PinchEvent>();
182 qmlRegisterType<QDeclarativeItem,1>("QtQuick",1,1,"Item");
183 qmlRegisterType<QDeclarative1MouseArea,1>("QtQuick",1,1,"MouseArea");
184 qmlRegisterType<QDeclarative1Flickable,1>("QtQuick",1,1,"Flickable");
185 qmlRegisterType<QDeclarative1ListView,1>("QtQuick",1,1,"ListView");
186 qmlRegisterType<QDeclarative1GridView,1>("QtQuick",1,1,"GridView");
187 qmlRegisterType<QDeclarative1Row,1>("QtQuick",1,1,"Row");
188 qmlRegisterType<QDeclarative1Grid,1>("QtQuick",1,1,"Grid");
189 qmlRegisterType<QDeclarative1Flow,1>("QtQuick",1,1,"Flow");
190 qmlRegisterType<QDeclarative1Repeater,1>("QtQuick",1,1,"Repeater");
191 qmlRegisterType<QDeclarative1Text,1>("QtQuick",1,1,"Text");
192 qmlRegisterType<QDeclarative1TextEdit,1>("QtQuick",1,1,"TextEdit");
193 #ifndef QT_NO_LINEEDIT
194 qmlRegisterType<QDeclarative1TextInput,1>("QtQuick",1,1,"TextInput");
196 qmlRegisterRevision<QDeclarative1ImageBase,1>("QtQuick",1,1);
197 qmlRegisterRevision<QDeclarative1ImplicitSizeItem,0>("QtQuick",1,0);
198 qmlRegisterRevision<QDeclarative1ImplicitSizeItem,1>("QtQuick",1,1);
199 qmlRegisterRevision<QDeclarative1ImplicitSizePaintedItem,0>("QtQuick",1,0);
200 qmlRegisterRevision<QDeclarative1ImplicitSizePaintedItem,1>("QtQuick",1,1);
201 qmlRegisterUncreatableType<QDeclarative1LayoutMirroringAttached>("QtQuick",1,1,"LayoutMirroring", QDeclarative1LayoutMirroringAttached::tr("LayoutMirroring is only available via attached properties"));
202 } else if (module == QDeclarativeQtQuick1Module::Qt47) {
204 qmlRegisterTypeNotAvailable("Qt",4,7,"AnimatedImage",
205 qApp->translate("QDeclarative1AnimatedImage","Qt was built without support for QMovie"));
207 qmlRegisterType<QDeclarative1AnimatedImage>("Qt",4,7,"AnimatedImage");
209 qmlRegisterType<QDeclarative1BorderImage>("Qt",4,7,"BorderImage");
210 qmlRegisterType<QDeclarative1Column>("Qt",4,7,"Column");
211 qmlRegisterType<QDeclarative1Drag>("Qt",4,7,"Drag");
212 qmlRegisterType<QDeclarative1Flickable>("Qt",4,7,"Flickable");
213 qmlRegisterType<QDeclarative1Flipable>("Qt",4,7,"Flipable");
214 qmlRegisterType<QDeclarative1Flow>("Qt",4,7,"Flow");
215 qmlRegisterType<QDeclarative1FocusPanel>("Qt",4,7,"FocusPanel");
216 qmlRegisterType<QDeclarative1FocusScope>("Qt",4,7,"FocusScope");
217 qmlRegisterType<QDeclarative1Gradient>("Qt",4,7,"Gradient");
218 qmlRegisterType<QDeclarative1GradientStop>("Qt",4,7,"GradientStop");
219 qmlRegisterType<QDeclarative1Grid>("Qt",4,7,"Grid");
220 qmlRegisterType<QDeclarative1GridView>("Qt",4,7,"GridView");
221 qmlRegisterType<QDeclarative1Image>("Qt",4,7,"Image");
222 qmlRegisterType<QDeclarativeItem>("Qt",4,7,"Item");
223 qmlRegisterType<QDeclarative1LayoutItem>("Qt",4,7,"LayoutItem");
224 qmlRegisterType<QDeclarative1ListView>("Qt",4,7,"ListView");
225 qmlRegisterType<QDeclarative1Loader>("Qt",4,7,"Loader");
226 qmlRegisterType<QDeclarative1MouseArea>("Qt",4,7,"MouseArea");
227 qmlRegisterType<QDeclarative1Path>("Qt",4,7,"Path");
228 qmlRegisterType<QDeclarative1PathAttribute>("Qt",4,7,"PathAttribute");
229 qmlRegisterType<QDeclarative1PathCubic>("Qt",4,7,"PathCubic");
230 qmlRegisterType<QDeclarative1PathLine>("Qt",4,7,"PathLine");
231 qmlRegisterType<QDeclarative1PathPercent>("Qt",4,7,"PathPercent");
232 qmlRegisterType<QDeclarative1PathQuad>("Qt",4,7,"PathQuad");
233 qmlRegisterType<QDeclarative1PathView>("Qt",4,7,"PathView");
234 #ifndef QT_NO_VALIDATOR
235 qmlRegisterType<QIntValidator>("Qt",4,7,"IntValidator");
236 qmlRegisterType<QDoubleValidator>("Qt",4,7,"DoubleValidator");
237 qmlRegisterType<QRegExpValidator>("Qt",4,7,"RegExpValidator");
239 qmlRegisterType<QDeclarative1Rectangle>("Qt",4,7,"Rectangle");
240 qmlRegisterType<QDeclarative1Repeater>("Qt",4,7,"Repeater");
241 qmlRegisterType<QGraphicsRotation>("Qt",4,7,"Rotation");
242 qmlRegisterType<QDeclarative1Row>("Qt",4,7,"Row");
243 qmlRegisterType<QDeclarative1Translate>("Qt",4,7,"Translate");
244 qmlRegisterType<QGraphicsScale>("Qt",4,7,"Scale");
245 qmlRegisterType<QDeclarative1Text>("Qt",4,7,"Text");
246 qmlRegisterType<QDeclarative1TextEdit>("Qt",4,7,"TextEdit");
247 #ifndef QT_NO_LINEEDIT
248 qmlRegisterType<QDeclarative1TextInput>("Qt",4,7,"TextInput");
250 qmlRegisterType<QDeclarative1ViewSection>("Qt",4,7,"ViewSection");
251 qmlRegisterType<QDeclarative1VisualDataModel>("Qt",4,7,"VisualDataModel");
252 qmlRegisterType<QDeclarative1VisualItemModel>("Qt",4,7,"VisualItemModel");
254 qmlRegisterType<QGraphicsWidget>("Qt",4,7,"QGraphicsWidget");
255 qmlRegisterExtendedType<QGraphicsWidget,QDeclarative1GraphicsWidget>("Qt",4,7,"QGraphicsWidget");
257 qmlRegisterUncreatableType<QDeclarative1KeyNavigationAttached>("Qt",4,7,"KeyNavigation",QDeclarative1KeyNavigationAttached::tr("KeyNavigation is only available via attached properties"));
258 qmlRegisterUncreatableType<QDeclarative1KeysAttached>("Qt",4,7,"Keys",QDeclarative1KeysAttached::tr("Keys is only available via attached properties"));