[844] | 1 | /****************************************************************************
|
---|
| 2 | **
|
---|
| 3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
| 4 | ** All rights reserved.
|
---|
| 5 | ** Contact: Nokia Corporation (qt-info@nokia.com)
|
---|
| 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 qt-info@nokia.com.
|
---|
| 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 |
|
---|
| 82 | static 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 |
|
---|
| 96 | void 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>();
|
---|
| 163 | #endif
|
---|
| 164 | qmlRegisterType<QDeclarativeVisualModel>();
|
---|
| 165 | #ifndef QT_NO_ACTION
|
---|
| 166 | qmlRegisterType<QAction>();
|
---|
| 167 | #endif
|
---|
| 168 | qmlRegisterType<QDeclarativePen>();
|
---|
| 169 | qmlRegisterType<QDeclarativeFlickableVisibleArea>();
|
---|
| 170 | #ifndef QT_NO_GRAPHICSEFFECT
|
---|
| 171 | qmlRegisterType<QGraphicsEffect>();
|
---|
| 172 | #endif
|
---|
| 173 |
|
---|
| 174 | qmlRegisterUncreatableType<QDeclarativeKeyNavigationAttached>("QtQuick",1,0,"KeyNavigation",QDeclarativeKeyNavigationAttached::tr("KeyNavigation is only available via attached properties"));
|
---|
| 175 | qmlRegisterUncreatableType<QDeclarativeKeysAttached>("QtQuick",1,0,"Keys",QDeclarativeKeysAttached::tr("Keys is only available via attached properties"));
|
---|
| 176 |
|
---|
| 177 | #ifndef QT_NO_IMPORT_QT47_QML
|
---|
| 178 | #ifdef QT_NO_MOVIE
|
---|
| 179 | qmlRegisterTypeNotAvailable("Qt",4,7,"AnimatedImage",
|
---|
| 180 | qApp->translate("QDeclarativeAnimatedImage","Qt was built without support for QMovie"));
|
---|
| 181 | #else
|
---|
| 182 | qmlRegisterType<QDeclarativeAnimatedImage>("Qt",4,7,"AnimatedImage");
|
---|
| 183 | #endif
|
---|
| 184 | qmlRegisterType<QDeclarativeBorderImage>("Qt",4,7,"BorderImage");
|
---|
| 185 | qmlRegisterType<QDeclarativeColumn>("Qt",4,7,"Column");
|
---|
| 186 | qmlRegisterType<QDeclarativeDrag>("Qt",4,7,"Drag");
|
---|
| 187 | qmlRegisterType<QDeclarativeFlickable>("Qt",4,7,"Flickable");
|
---|
| 188 | qmlRegisterType<QDeclarativeFlipable>("Qt",4,7,"Flipable");
|
---|
| 189 | qmlRegisterType<QDeclarativeFlow>("Qt",4,7,"Flow");
|
---|
| 190 | qmlRegisterType<QDeclarativeFocusPanel>("Qt",4,7,"FocusPanel");
|
---|
| 191 | qmlRegisterType<QDeclarativeFocusScope>("Qt",4,7,"FocusScope");
|
---|
| 192 | qmlRegisterType<QDeclarativeGradient>("Qt",4,7,"Gradient");
|
---|
| 193 | qmlRegisterType<QDeclarativeGradientStop>("Qt",4,7,"GradientStop");
|
---|
| 194 | qmlRegisterType<QDeclarativeGrid>("Qt",4,7,"Grid");
|
---|
| 195 | qmlRegisterType<QDeclarativeGridView>("Qt",4,7,"GridView");
|
---|
| 196 | qmlRegisterType<QDeclarativeImage>("Qt",4,7,"Image");
|
---|
| 197 | qmlRegisterType<QDeclarativeItem>("Qt",4,7,"Item");
|
---|
| 198 | qmlRegisterType<QDeclarativeLayoutItem>("Qt",4,7,"LayoutItem");
|
---|
| 199 | qmlRegisterType<QDeclarativeListView>("Qt",4,7,"ListView");
|
---|
| 200 | qmlRegisterType<QDeclarativeLoader>("Qt",4,7,"Loader");
|
---|
| 201 | qmlRegisterType<QDeclarativeMouseArea>("Qt",4,7,"MouseArea");
|
---|
| 202 | qmlRegisterType<QDeclarativePath>("Qt",4,7,"Path");
|
---|
| 203 | qmlRegisterType<QDeclarativePathAttribute>("Qt",4,7,"PathAttribute");
|
---|
| 204 | qmlRegisterType<QDeclarativePathCubic>("Qt",4,7,"PathCubic");
|
---|
| 205 | qmlRegisterType<QDeclarativePathLine>("Qt",4,7,"PathLine");
|
---|
| 206 | qmlRegisterType<QDeclarativePathPercent>("Qt",4,7,"PathPercent");
|
---|
| 207 | qmlRegisterType<QDeclarativePathQuad>("Qt",4,7,"PathQuad");
|
---|
| 208 | qmlRegisterType<QDeclarativePathView>("Qt",4,7,"PathView");
|
---|
| 209 | #ifndef QT_NO_VALIDATOR
|
---|
| 210 | qmlRegisterType<QIntValidator>("Qt",4,7,"IntValidator");
|
---|
| 211 | qmlRegisterType<QDoubleValidator>("Qt",4,7,"DoubleValidator");
|
---|
| 212 | qmlRegisterType<QRegExpValidator>("Qt",4,7,"RegExpValidator");
|
---|
| 213 | #endif
|
---|
| 214 | qmlRegisterType<QDeclarativeRectangle>("Qt",4,7,"Rectangle");
|
---|
| 215 | qmlRegisterType<QDeclarativeRepeater>("Qt",4,7,"Repeater");
|
---|
| 216 | qmlRegisterType<QGraphicsRotation>("Qt",4,7,"Rotation");
|
---|
| 217 | qmlRegisterType<QDeclarativeRow>("Qt",4,7,"Row");
|
---|
| 218 | qmlRegisterType<QDeclarativeTranslate>("Qt",4,7,"Translate");
|
---|
| 219 | qmlRegisterType<QGraphicsScale>("Qt",4,7,"Scale");
|
---|
| 220 | qmlRegisterType<QDeclarativeText>("Qt",4,7,"Text");
|
---|
| 221 | qmlRegisterType<QDeclarativeTextEdit>("Qt",4,7,"TextEdit");
|
---|
| 222 | #ifndef QT_NO_LINEEDIT
|
---|
| 223 | qmlRegisterType<QDeclarativeTextInput>("Qt",4,7,"TextInput");
|
---|
| 224 | #endif
|
---|
| 225 | qmlRegisterType<QDeclarativeViewSection>("Qt",4,7,"ViewSection");
|
---|
| 226 | qmlRegisterType<QDeclarativeVisualDataModel>("Qt",4,7,"VisualDataModel");
|
---|
| 227 | qmlRegisterType<QDeclarativeVisualItemModel>("Qt",4,7,"VisualItemModel");
|
---|
| 228 |
|
---|
| 229 | qmlRegisterType<QGraphicsWidget>("Qt",4,7,"QGraphicsWidget");
|
---|
| 230 | qmlRegisterExtendedType<QGraphicsWidget,QDeclarativeGraphicsWidget>("Qt",4,7,"QGraphicsWidget");
|
---|
| 231 |
|
---|
| 232 | qmlRegisterUncreatableType<QDeclarativeKeyNavigationAttached>("Qt",4,7,"KeyNavigation",QDeclarativeKeyNavigationAttached::tr("KeyNavigation is only available via attached properties"));
|
---|
| 233 | qmlRegisterUncreatableType<QDeclarativeKeysAttached>("Qt",4,7,"Keys",QDeclarativeKeysAttached::tr("Keys is only available via attached properties"));
|
---|
| 234 | #endif
|
---|
| 235 | }
|
---|