diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-04-27 07:45:25 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-04-27 07:45:25 (GMT) |
commit | eae3489b3f2fba9d733ca50eb89dc92a6e96e6f8 (patch) | |
tree | c114a1d79932d0b0d7ab811040a50a7241323789 /src/declarative/qml | |
parent | 768658b51ebabff535263efb0870b436beb00fcc (diff) | |
parent | d545dc70c03eca620275658450402f67af166ef0 (diff) | |
download | Qt-eae3489b3f2fba9d733ca50eb89dc92a6e96e6f8.zip Qt-eae3489b3f2fba9d733ca50eb89dc92a6e96e6f8.tar.gz Qt-eae3489b3f2fba9d733ca50eb89dc92a6e96e6f8.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/qmlmetaproperty.cpp | 31 | ||||
-rw-r--r-- | src/declarative/qml/qmlmetaproperty.h | 8 |
2 files changed, 37 insertions, 2 deletions
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index 1218b99..e7f7cfb 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -103,7 +103,18 @@ QmlMetaProperty::~QmlMetaProperty() // ### not thread safe static QHash<const QMetaObject *, QMetaPropertyEx> qmlCacheDefProp; + +/*! + Creates a QmlMetaProperty for the default property of \a obj. If there is no + default property, an invalid QmlMetaProperty will be created. + */ +QmlMetaProperty::QmlMetaProperty(QObject *obj) +{ + initDefault(obj); +} + /*! + \internal Creates a QmlMetaProperty for the default property of \a obj. If there is no default property, an invalid QmlMetaProperty will be created. */ @@ -111,6 +122,11 @@ QmlMetaProperty::QmlMetaProperty(QObject *obj, QmlContext *ctxt) : d(new QmlMetaPropertyPrivate) { d->context = ctxt; + initDefault(obj); +} + +void QmlMetaProperty::initDefault(QObject *obj) +{ if(!obj) return; @@ -162,6 +178,16 @@ static QHash<const QMetaObject *, QHash<QString, QMetaPropertyEx> > qmlCacheProp /*! Creates a QmlMetaProperty for the property \a name of \a obj. */ +QmlMetaProperty::QmlMetaProperty(QObject *obj, const QString &name) +: d(new QmlMetaPropertyPrivate) +{ + initProperty(obj, name); +} + +/*! + \internal + Creates a QmlMetaProperty for the property \a name of \a obj. + */ QmlMetaProperty::QmlMetaProperty(QObject *obj, const QString &name, QmlContext *ctxt) : d(new QmlMetaPropertyPrivate) { @@ -170,6 +196,11 @@ QmlMetaProperty::QmlMetaProperty(QObject *obj, const QString &name, QmlContext * #endif d->context = ctxt; + initProperty(obj, name); +} + +void QmlMetaProperty::initProperty(QObject *obj, const QString &name) +{ d->name = name; d->object = obj; if(name.isEmpty() || !obj) diff --git a/src/declarative/qml/qmlmetaproperty.h b/src/declarative/qml/qmlmetaproperty.h index a2939f9..4836038 100644 --- a/src/declarative/qml/qmlmetaproperty.h +++ b/src/declarative/qml/qmlmetaproperty.h @@ -72,8 +72,10 @@ public: Normal }; QmlMetaProperty(); - QmlMetaProperty(QObject *, QmlContext * = 0); - QmlMetaProperty(QObject *, const QString &, QmlContext * = 0); + QmlMetaProperty(QObject *); + QmlMetaProperty(QObject *, const QString &); + QmlMetaProperty(QObject *, QmlContext *); + QmlMetaProperty(QObject *, const QString &, QmlContext *); QmlMetaProperty(const QmlMetaProperty &); QmlMetaProperty &operator=(const QmlMetaProperty &); QmlMetaProperty(QObject *, int, PropertyCategory = Unknown, QmlContext * = 0); @@ -125,6 +127,8 @@ public: int coreIndex() const; private: + void initDefault(QObject *obj); + void initProperty(QObject *obj, const QString &name); friend class QmlEnginePrivate; QmlMetaPropertyPrivate *d; }; |