source: trunk/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp

Last change on this file was 846, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 11.7 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the QtDeclarative module of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#include "private/qdeclarativeitemsmodule_p.h"
43
44#include <QtGui/qaction.h>
45#include <QtGui/qvalidator.h>
46#include <QtGui/qgraphicseffect.h>
47
48#include "private/qdeclarativeevents_p_p.h"
49#include "private/qdeclarativescalegrid_p_p.h"
50#include "private/qdeclarativeanimatedimage_p.h"
51#include "private/qdeclarativeborderimage_p.h"
52#include "private/qdeclarativepositioners_p.h"
53#include "private/qdeclarativemousearea_p.h"
54#include "private/qdeclarativeflickable_p.h"
55#include "private/qdeclarativeflickable_p_p.h"
56#include "private/qdeclarativeflipable_p.h"
57#include "private/qdeclarativefocuspanel_p.h"
58#include "private/qdeclarativefocusscope_p.h"
59#include "private/qdeclarativegridview_p.h"
60#include "private/qdeclarativeimage_p.h"
61#include "private/qdeclarativeitem_p.h"
62#include "private/qdeclarativelayoutitem_p.h"
63#include "private/qdeclarativelistview_p.h"
64#include "private/qdeclarativeloader_p.h"
65#include "private/qdeclarativemousearea_p.h"
66#include "private/qdeclarativepath_p.h"
67#include "private/qdeclarativepathview_p.h"
68#include "private/qdeclarativerectangle_p.h"
69#include "private/qdeclarativerepeater_p.h"
70#include "private/qdeclarativetranslate_p.h"
71#include "private/qdeclarativetext_p.h"
72#include "private/qdeclarativetextedit_p.h"
73#include "private/qdeclarativetextinput_p.h"
74#include "private/qdeclarativevisualitemmodel_p.h"
75#include "private/qdeclarativegraphicswidget_p.h"
76#ifdef QT_WEBKIT_LIB
77#include "private/qdeclarativewebview_p.h"
78#include "private/qdeclarativewebview_p_p.h"
79#endif
80#include "private/qdeclarativeanchors_p.h"
81
82static QDeclarativePrivate::AutoParentResult qgraphicsobject_autoParent(QObject *obj, QObject *parent)
83{
84 QGraphicsObject* gobj = qobject_cast<QGraphicsObject*>(obj);
85 if (!gobj)
86 return QDeclarativePrivate::IncompatibleObject;
87
88 QGraphicsObject* gparent = qobject_cast<QGraphicsObject*>(parent);
89 if (!gparent)
90 return QDeclarativePrivate::IncompatibleParent;
91
92 gobj->setParentItem(gparent);
93 return QDeclarativePrivate::Parented;
94}
95
96void QDeclarativeItemModule::defineModule()
97{
98 QDeclarativePrivate::RegisterAutoParent autoparent = { 0, &qgraphicsobject_autoParent };
99 QDeclarativePrivate::qmlregister(QDeclarativePrivate::AutoParentRegistration, &autoparent);
100#ifdef QT_NO_MOVIE
101 qmlRegisterTypeNotAvailable("QtQuick",1,0,"AnimatedImage",
102 qApp->translate("QDeclarativeAnimatedImage","Qt was built without support for QMovie"));
103#else
104 qmlRegisterType<QDeclarativeAnimatedImage>("QtQuick",1,0,"AnimatedImage");
105#endif
106 qmlRegisterType<QDeclarativeBorderImage>("QtQuick",1,0,"BorderImage");
107 qmlRegisterType<QDeclarativeColumn>("QtQuick",1,0,"Column");
108 qmlRegisterType<QDeclarativeDrag>("QtQuick",1,0,"Drag");
109 qmlRegisterType<QDeclarativeFlickable>("QtQuick",1,0,"Flickable");
110 qmlRegisterType<QDeclarativeFlipable>("QtQuick",1,0,"Flipable");
111 qmlRegisterType<QDeclarativeFlow>("QtQuick",1,0,"Flow");
112 qmlRegisterType<QDeclarativeFocusPanel>("QtQuick",1,0,"FocusPanel");
113 qmlRegisterType<QDeclarativeFocusScope>("QtQuick",1,0,"FocusScope");
114 qmlRegisterType<QDeclarativeGradient>("QtQuick",1,0,"Gradient");
115 qmlRegisterType<QDeclarativeGradientStop>("QtQuick",1,0,"GradientStop");
116 qmlRegisterType<QDeclarativeGrid>("QtQuick",1,0,"Grid");
117 qmlRegisterType<QDeclarativeGridView>("QtQuick",1,0,"GridView");
118 qmlRegisterType<QDeclarativeImage>("QtQuick",1,0,"Image");
119 qmlRegisterType<QDeclarativeItem>("QtQuick",1,0,"Item");
120 qmlRegisterType<QDeclarativeLayoutItem>("QtQuick",1,0,"LayoutItem");
121 qmlRegisterType<QDeclarativeListView>("QtQuick",1,0,"ListView");
122 qmlRegisterType<QDeclarativeLoader>("QtQuick",1,0,"Loader");
123 qmlRegisterType<QDeclarativeMouseArea>("QtQuick",1,0,"MouseArea");
124 qmlRegisterType<QDeclarativePath>("QtQuick",1,0,"Path");
125 qmlRegisterType<QDeclarativePathAttribute>("QtQuick",1,0,"PathAttribute");
126 qmlRegisterType<QDeclarativePathCubic>("QtQuick",1,0,"PathCubic");
127 qmlRegisterType<QDeclarativePathLine>("QtQuick",1,0,"PathLine");
128 qmlRegisterType<QDeclarativePathPercent>("QtQuick",1,0,"PathPercent");
129 qmlRegisterType<QDeclarativePathQuad>("QtQuick",1,0,"PathQuad");
130 qmlRegisterType<QDeclarativePathView>("QtQuick",1,0,"PathView");
131#ifndef QT_NO_VALIDATOR
132 qmlRegisterType<QIntValidator>("QtQuick",1,0,"IntValidator");
133 qmlRegisterType<QDoubleValidator>("QtQuick",1,0,"DoubleValidator");
134 qmlRegisterType<QRegExpValidator>("QtQuick",1,0,"RegExpValidator");
135#endif
136 qmlRegisterType<QDeclarativeRectangle>("QtQuick",1,0,"Rectangle");
137 qmlRegisterType<QDeclarativeRepeater>("QtQuick",1,0,"Repeater");
138 qmlRegisterType<QGraphicsRotation>("QtQuick",1,0,"Rotation");
139 qmlRegisterType<QDeclarativeRow>("QtQuick",1,0,"Row");
140 qmlRegisterType<QDeclarativeTranslate>("QtQuick",1,0,"Translate");
141 qmlRegisterType<QGraphicsScale>("QtQuick",1,0,"Scale");
142 qmlRegisterType<QDeclarativeText>("QtQuick",1,0,"Text");
143 qmlRegisterType<QDeclarativeTextEdit>("QtQuick",1,0,"TextEdit");
144#ifndef QT_NO_LINEEDIT
145 qmlRegisterType<QDeclarativeTextInput>("QtQuick",1,0,"TextInput");
146#endif
147 qmlRegisterType<QDeclarativeViewSection>("QtQuick",1,0,"ViewSection");
148 qmlRegisterType<QDeclarativeVisualDataModel>("QtQuick",1,0,"VisualDataModel");
149 qmlRegisterType<QDeclarativeVisualItemModel>("QtQuick",1,0,"VisualItemModel");
150
151 qmlRegisterType<QDeclarativeAnchors>();
152 qmlRegisterType<QDeclarativeKeyEvent>();
153 qmlRegisterType<QDeclarativeMouseEvent>();
154 qmlRegisterType<QGraphicsObject>();
155 qmlRegisterType<QGraphicsWidget>("QtQuick",1,0,"QGraphicsWidget");
156 qmlRegisterExtendedType<QGraphicsWidget,QDeclarativeGraphicsWidget>("QtQuick",1,0,"QGraphicsWidget");
157 qmlRegisterType<QGraphicsTransform>();
158 qmlRegisterType<QDeclarativePathElement>();
159 qmlRegisterType<QDeclarativeCurve>();
160 qmlRegisterType<QDeclarativeScaleGrid>();
161#ifndef QT_NO_VALIDATOR
162 qmlRegisterType<QValidator>();