src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
child 37 758a864f9613
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
    77 #include "private/qdeclarativewebview_p.h"
    77 #include "private/qdeclarativewebview_p.h"
    78 #include "private/qdeclarativewebview_p_p.h"
    78 #include "private/qdeclarativewebview_p_p.h"
    79 #endif
    79 #endif
    80 #include "private/qdeclarativeanchors_p.h"
    80 #include "private/qdeclarativeanchors_p.h"
    81 
    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 
    82 void QDeclarativeItemModule::defineModule()
    96 void QDeclarativeItemModule::defineModule()
    83 {
    97 {
       
    98     QDeclarativePrivate::RegisterAutoParent autoparent = { 0, &qgraphicsobject_autoParent };
       
    99     QDeclarativePrivate::qmlregister(QDeclarativePrivate::AutoParentRegistration, &autoparent);
       
   100 
    84 #ifdef QT_NO_MOVIE
   101 #ifdef QT_NO_MOVIE
    85     qmlRegisterTypeNotAvailable("Qt",4,7,"AnimatedImage",
   102     qmlRegisterTypeNotAvailable("Qt",4,7,"AnimatedImage",
    86         qApp->translate("QDeclarativeAnimatedImage","Qt was built without support for QMovie"));
   103         qApp->translate("QDeclarativeAnimatedImage","Qt was built without support for QMovie"));
    87 #else
   104 #else
    88     qmlRegisterType<QDeclarativeAnimatedImage>("Qt",4,7,"AnimatedImage");
   105     qmlRegisterType<QDeclarativeAnimatedImage>("Qt",4,7,"AnimatedImage");
   110     qmlRegisterType<QDeclarativePathCubic>("Qt",4,7,"PathCubic");
   127     qmlRegisterType<QDeclarativePathCubic>("Qt",4,7,"PathCubic");
   111     qmlRegisterType<QDeclarativePathLine>("Qt",4,7,"PathLine");
   128     qmlRegisterType<QDeclarativePathLine>("Qt",4,7,"PathLine");
   112     qmlRegisterType<QDeclarativePathPercent>("Qt",4,7,"PathPercent");
   129     qmlRegisterType<QDeclarativePathPercent>("Qt",4,7,"PathPercent");
   113     qmlRegisterType<QDeclarativePathQuad>("Qt",4,7,"PathQuad");
   130     qmlRegisterType<QDeclarativePathQuad>("Qt",4,7,"PathQuad");
   114     qmlRegisterType<QDeclarativePathView>("Qt",4,7,"PathView");
   131     qmlRegisterType<QDeclarativePathView>("Qt",4,7,"PathView");
       
   132 #ifndef QT_NO_VALIDATOR
   115     qmlRegisterType<QIntValidator>("Qt",4,7,"IntValidator");
   133     qmlRegisterType<QIntValidator>("Qt",4,7,"IntValidator");
   116     qmlRegisterType<QDoubleValidator>("Qt",4,7,"DoubleValidator");
   134     qmlRegisterType<QDoubleValidator>("Qt",4,7,"DoubleValidator");
   117     qmlRegisterType<QRegExpValidator>("Qt",4,7,"RegExpValidator");
   135     qmlRegisterType<QRegExpValidator>("Qt",4,7,"RegExpValidator");
       
   136 #endif
   118     qmlRegisterType<QDeclarativeRectangle>("Qt",4,7,"Rectangle");
   137     qmlRegisterType<QDeclarativeRectangle>("Qt",4,7,"Rectangle");
   119     qmlRegisterType<QDeclarativeRepeater>("Qt",4,7,"Repeater");
   138     qmlRegisterType<QDeclarativeRepeater>("Qt",4,7,"Repeater");
   120     qmlRegisterType<QGraphicsRotation>("Qt",4,7,"Rotation");
   139     qmlRegisterType<QGraphicsRotation>("Qt",4,7,"Rotation");
   121     qmlRegisterType<QDeclarativeRow>("Qt",4,7,"Row");
   140     qmlRegisterType<QDeclarativeRow>("Qt",4,7,"Row");
   122     qmlRegisterType<QDeclarativeTranslate>("Qt",4,7,"Translate");
   141     qmlRegisterType<QDeclarativeTranslate>("Qt",4,7,"Translate");
   136     qmlRegisterExtendedType<QGraphicsWidget,QDeclarativeGraphicsWidget>("Qt",4,7,"QGraphicsWidget");
   155     qmlRegisterExtendedType<QGraphicsWidget,QDeclarativeGraphicsWidget>("Qt",4,7,"QGraphicsWidget");
   137     qmlRegisterType<QGraphicsTransform>();
   156     qmlRegisterType<QGraphicsTransform>();
   138     qmlRegisterType<QDeclarativePathElement>();
   157     qmlRegisterType<QDeclarativePathElement>();
   139     qmlRegisterType<QDeclarativeCurve>();
   158     qmlRegisterType<QDeclarativeCurve>();
   140     qmlRegisterType<QDeclarativeScaleGrid>();
   159     qmlRegisterType<QDeclarativeScaleGrid>();
       
   160 #ifndef QT_NO_VALIDATOR
   141     qmlRegisterType<QValidator>();
   161     qmlRegisterType<QValidator>();
       
   162 #endif
   142     qmlRegisterType<QDeclarativeVisualModel>();
   163     qmlRegisterType<QDeclarativeVisualModel>();
       
   164 #ifndef QT_NO_ACTION
   143     qmlRegisterType<QAction>();
   165     qmlRegisterType<QAction>();
       
   166 #endif
   144     qmlRegisterType<QDeclarativePen>();
   167     qmlRegisterType<QDeclarativePen>();
   145     qmlRegisterType<QDeclarativeFlickableVisibleArea>();
   168     qmlRegisterType<QDeclarativeFlickableVisibleArea>();
   146 #ifndef QT_NO_GRAPHICSEFFECT
   169 #ifndef QT_NO_GRAPHICSEFFECT
   147     qmlRegisterType<QGraphicsEffect>();
   170     qmlRegisterType<QGraphicsEffect>();
   148 #endif
   171 #endif