diff options
Diffstat (limited to 'src/declarative/qml/qmlmetaproperty.cpp')
-rw-r--r-- | src/declarative/qml/qmlmetaproperty.cpp | 31 |
1 files changed, 31 insertions, 0 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) |