From ff8d23d5754ca7160ec1be6e5e8d573eca018713 Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Thu, 17 Dec 2009 14:21:36 +0100 Subject: Add context argument to QmlMetaProperty::createProperty Without a context the properties with a QUrl type are not resolved. Reviewed-by: Kai Koehne --- src/declarative/qml/qmlmetaproperty.cpp | 9 +++++---- src/declarative/qml/qmlmetaproperty.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index a315141..6738370 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -1121,11 +1121,12 @@ QmlMetaPropertyPrivate::restore(const QByteArray &data, QObject *object, QmlCont \internal Creates a QmlMetaProperty for the property \a name of \a obj. Unlike - the QmlMetaProperty(QObject*, QString) constructor, this static function + the QmlMetaProperty(QObject*, QString, QmlContext*) constructor, this static function will correctly handle dot properties. */ QmlMetaProperty QmlMetaProperty::createProperty(QObject *obj, - const QString &name) + const QString &name, + QmlContext *context) { QStringList path = name.split(QLatin1Char('.')); @@ -1133,7 +1134,7 @@ QmlMetaProperty QmlMetaProperty::createProperty(QObject *obj, for (int jj = 0; jj < path.count() - 1; ++jj) { const QString &pathName = path.at(jj); - QmlMetaProperty prop(object, pathName); + QmlMetaProperty prop(object, pathName, context); if (jj == path.count() - 2 && prop.propertyType() < (int)QVariant::UserType && @@ -1159,7 +1160,7 @@ QmlMetaProperty QmlMetaProperty::createProperty(QObject *obj, } const QString &propName = path.last(); - QmlMetaProperty prop(object, propName); + QmlMetaProperty prop(object, propName, context); if (!prop.isValid()) return QmlMetaProperty(); else diff --git a/src/declarative/qml/qmlmetaproperty.h b/src/declarative/qml/qmlmetaproperty.h index 4b343f0..dcb5905 100644 --- a/src/declarative/qml/qmlmetaproperty.h +++ b/src/declarative/qml/qmlmetaproperty.h @@ -127,7 +127,7 @@ public: QmlExpression *signalExpression() const; QmlExpression *setSignalExpression(QmlExpression *) const; - static QmlMetaProperty createProperty(QObject *, const QString &); + static QmlMetaProperty createProperty(QObject *, const QString &, QmlContext *context=0); int coreIndex() const; int valueTypeCoreIndex() const; -- cgit v0.12