/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtQuick module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qquickitemsmodule_p.h" #include "qquickitem.h" #include "qquickitem_p.h" #include "qquickevents_p_p.h" #include "qquickrectangle_p.h" #include "qquickfocusscope_p.h" #include "qquicktext_p.h" #include "qquicktextinput_p.h" #include "qquicktextedit_p.h" #include "qquicktextdocument.h" #include "qquickimage_p.h" #include "qquickborderimage_p.h" #include "qquickscalegrid_p_p.h" #include "qquickmousearea_p.h" #include "qquickpincharea_p.h" #include "qquickflickable_p.h" #include "qquickflickable_p_p.h" #include "qquicklistview_p.h" #include "qquickgridview_p.h" #include "qquickpathview_p.h" #include "qquickitemviewtransition_p.h" #include #include #include "qquickpositioners_p.h" #include "qquickrepeater_p.h" #include "qquickloader_p.h" #include "qquickanimatedimage_p.h" #include "qquickflipable_p.h" #include "qquicktranslate_p.h" #include "qquickstateoperations_p.h" #include "qquickitemanimation_p.h" #include #include //#include #include #include #include "qquicksprite_p.h" #include "qquickspritesequence_p.h" #include "qquickanimatedsprite_p.h" #include "qquickdrag_p.h" #include "qquickdroparea_p.h" #include "qquickmultipointtoucharea_p.h" #include #include static QQmlPrivate::AutoParentResult qquickitem_autoParent(QObject *obj, QObject *parent) { // When setting a parent (especially during dynamic object creation) in QML, // also try to set up the analogous item/window relationship. QQuickItem *parentItem = qmlobject_cast(parent); if (parentItem) { QQuickItem *item = qmlobject_cast(obj); if (item) { // An Item has another Item item->setParentItem(parentItem); return QQmlPrivate::Parented; } else if (parentItem->window()) { QQuickWindow *win = qmlobject_cast(obj); if (win) { // A Window inside an Item should be transient for that item's window win->setTransientParent(parentItem->window()); return QQmlPrivate::Parented; } } return QQmlPrivate::IncompatibleObject; } else { QQuickWindow *parentWindow = qmlobject_cast(parent); if (parentWindow) { QQuickWindow *win = qmlobject_cast(obj); if (win) { // A Window inside a Window should be transient for it win->setTransientParent(parentWindow); return QQmlPrivate::Parented; } else { QQuickItem *item = qmlobject_cast(obj); if (item) { // The parent of an Item inside a Window is actually the implicit content Item item->setParentItem(parentWindow->contentItem()); return QQmlPrivate::Parented; } } return QQmlPrivate::IncompatibleObject; } } return QQmlPrivate::IncompatibleParent; } static bool compareQQuickAnchorLines(const void *p1, const void *p2) { const QQuickAnchorLine &l1 = *static_cast(p1); const QQuickAnchorLine &l2 = *static_cast(p2); return l1 == l2; } static void qt_quickitems_defineModule(const char *uri, int major, int minor) { QQmlPrivate::RegisterAutoParent autoparent = { 0, &qquickitem_autoParent }; QQmlPrivate::qmlregister(QQmlPrivate::AutoParentRegistration, &autoparent); QQuickItemPrivate::registerAccessorProperties(); #ifdef QT_NO_MOVIE qmlRegisterTypeNotAvailable(uri,major,minor,"AnimatedImage", qApp->translate("QQuickAnimatedImage","Qt was built without support for QMovie")); #else qmlRegisterType(uri,major,minor,"AnimatedImage"); #endif qmlRegisterType(uri,major,minor,"BorderImage"); qmlRegisterType(uri,major,minor,"Column"); qmlRegisterType(uri,major,minor,"Flickable"); qmlRegisterType(uri,major,minor,"Flipable"); qmlRegisterType(uri,major,minor,"Flow"); // qmlRegisterType(uri,major,minor,"FocusPanel"); qmlRegisterType(uri,major,minor,"FocusScope"); qmlRegisterType(uri,major,minor,"Gradient"); qmlRegisterType(uri,major,minor,"GradientStop"); qmlRegisterType(uri,major,minor,"Grid"); qmlRegisterType(uri,major,minor,"GridView"); qmlRegisterType(uri,major,minor,"Image"); qmlRegisterType(uri,major,minor,"Item"); qmlRegisterType(uri,major,minor,"ListView"); qmlRegisterType(uri,major,minor,"Loader"); qmlRegisterType(uri,major,minor,"MouseArea"); qmlRegisterType(uri,major,minor,"Path"); qmlRegisterType(uri,major,minor,"PathAttribute"); qmlRegisterType(uri,major,minor,"PathCubic"); qmlRegisterType(uri,major,minor,"PathLine"); qmlRegisterType(uri,major,minor,"PathPercent"); qmlRegisterType(uri,major,minor,"PathQuad"); qmlRegisterType("QtQuick",2,0,"PathCurve"); qmlRegisterType("QtQuick",2,0,"PathArc"); qmlRegisterType("QtQuick",2,0,"PathSvg"); qmlRegisterType(uri,major,minor,"PathView"); qmlRegisterUncreatableType(uri,major,minor,"Positioner", QStringLiteral("Positioner is an abstract type that is only available as an attached property.")); #ifndef QT_NO_VALIDATOR qmlRegisterType(uri,major,minor,"IntValidator"); qmlRegisterType(uri,major,minor,"DoubleValidator"); qmlRegisterType(uri,major,minor,"RegExpValidator"); #endif qmlRegisterType(uri,major,minor,"Rectangle"); qmlRegisterType(uri,major,minor,"Repeater"); qmlRegisterType(uri,major,minor,"Row"); qmlRegisterType(uri,major,minor,"Translate"); qmlRegisterType(uri,major,minor,"Rotation"); qmlRegisterType(uri,major,minor,"Scale"); qmlRegisterType(uri,2,4,"Matrix4x4"); qmlRegisterType(uri,major,minor,"Text"); qmlRegisterType(uri,major,minor,"TextEdit"); qmlRegisterType(uri,2,1,"TextEdit"); qmlRegisterType(uri,major,minor,"TextInput"); qmlRegisterType(uri,2,2,"TextInput"); qmlRegisterType(uri,major,minor,"ViewSection"); qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); #ifndef QT_NO_VALIDATOR qmlRegisterType(); #endif qmlRegisterType(); qmlRegisterType(); qRegisterMetaType("QQuickAnchorLine"); QQmlMetaType::setQQuickAnchorLineCompareFunction(compareQQuickAnchorLines); qmlRegisterType(); qmlRegisterUncreatableType(uri,major,minor,"KeyNavigation",QQuickKeyNavigationAttached::tr("KeyNavigation is only available via attached properties")); qmlRegisterUncreatableType(uri,major,minor,"Keys",QQuickKeysAttached::tr("Keys is only available via attached properties")); qmlRegisterUncreatableType(uri,major,minor,"LayoutMirroring", QQuickLayoutMirroringAttached::tr("LayoutMirroring is only available via attached properties")); qmlRegisterUncreatableType(uri,major,minor,"ViewTransition",QQuickViewTransitionAttached::tr("ViewTransition is only available via attached properties")); qmlRegisterType(uri,major,minor,"PinchArea"); qmlRegisterType(uri,major,minor,"Pinch"); qmlRegisterType(); qmlRegisterType("QtQuick", 2, 0, "ShaderEffect"); qmlRegisterType("QtQuick", 2, 0, "ShaderEffectSource"); qmlRegisterUncreatableType("QtQuick", 2, 0, "ShaderEffectMesh", QQuickShaderEffectMesh::tr("Cannot create instance of abstract class ShaderEffectMesh.")); qmlRegisterType("QtQuick", 2, 0, "GridMesh"); qmlRegisterUncreatableType("QtQuick", 2, 0, "PaintedItem", QQuickPaintedItem::tr("Cannot create instance of abstract class PaintedItem")); qmlRegisterType("QtQuick", 2, 0, "Canvas"); qmlRegisterType("QtQuick", 2, 0, "Sprite"); qmlRegisterType("QtQuick", 2, 0, "AnimatedSprite"); qmlRegisterType("QtQuick", 2, 0, "SpriteSequence"); qmlRegisterType(uri, major, minor,"ParentChange"); qmlRegisterType(uri, major, minor,"AnchorChanges"); qmlRegisterType(); qmlRegisterType(uri, major, minor,"AnchorAnimation"); qmlRegisterType(uri, major, minor,"ParentAnimation"); qmlRegisterType("QtQuick",2,0,"PathAnimation"); qmlRegisterType("QtQuick",2,0,"PathInterpolator"); #ifndef QT_NO_DRAGANDDROP qmlRegisterType("QtQuick", 2, 0, "DropArea"); qmlRegisterType(); qmlRegisterType(); qmlRegisterUncreatableType("QtQuick", 2, 0, "Drag", QQuickDragAttached::tr("Drag is only available via attached properties")); #endif qmlRegisterType("QtQuick", 2, 0, "MultiPointTouchArea"); qmlRegisterType("QtQuick", 2, 0, "TouchPoint"); qmlRegisterType(); #ifndef QT_NO_ACCESSIBILITY qmlRegisterUncreatableType("QtQuick", 2, 0, "Accessible",QQuickAccessibleAttached::tr("Accessible is only available via attached properties")); #endif qmlRegisterType(uri, 2, 1,"Item"); qmlRegisterType(uri, 2, 1, "Grid"); qmlRegisterUncreatableType(uri, 2, 1, "ItemView", QQuickItemView::tr("ItemView is an abstract base class")); qmlRegisterUncreatableType(uri, 2, 3, "ItemView", QQuickItemView::tr("ItemView is an abstract base class")); qmlRegisterType(uri, 2, 1, "ListView"); qmlRegisterType(uri, 2, 1, "GridView"); qmlRegisterType(uri, 2, 1, "TextEdit"); qmlRegisterType(uri, 2, 2, "Text"); qmlRegisterType(uri, 2, 2, "TextEdit"); } static void initResources() { Q_INIT_RESOURCE(items); } QT_BEGIN_NAMESPACE void QQuickItemsModule::defineModule() { initResources(); QByteArray name = "QtQuick"; int majorVersion = 2; int minorVersion = 0; qt_quickitems_defineModule(name, majorVersion, minorVersion); } QT_END_NAMESPACE