diff options
-rw-r--r-- | src/qml/qml/qqmlproperty.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp index 0ee8f94a66..b85208322a 100644 --- a/src/qml/qml/qqmlproperty.cpp +++ b/src/qml/qml/qqmlproperty.cpp @@ -276,7 +276,7 @@ void QQmlPropertyPrivate::initProperty(QObject *obj, const QString &name) QQmlPropertyData local; QQmlPropertyData *property = - QQmlPropertyCache::property(engine, obj, pathName, context, local); + QQmlPropertyCache::property(engine, currentObject, pathName, context, local); if (!property) return; // Not a property if (property->isFunction()) diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp index 62ccec5794..ed09e6d14f 100644 --- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp +++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp @@ -47,8 +47,12 @@ class MyQmlObject : public QObject { Q_OBJECT + Q_PROPERTY(QPoint pointProperty MEMBER m_point) public: MyQmlObject(QObject *parent = 0) : QObject(parent) {} + +private: + QPoint m_point; }; QML_DECLARE_TYPE(MyQmlObject); @@ -141,6 +145,7 @@ private slots: void assignEmptyVariantMap(); void warnOnInvalidBinding(); void registeredCompositeTypeProperty(); + void deeplyNestedObject(); void copy(); private: @@ -1938,6 +1943,16 @@ void tst_qqmlproperty::warnOnInvalidBinding() delete obj; } +void tst_qqmlproperty::deeplyNestedObject() +{ + PropertyObject o; + QQmlProperty p(&o, "qmlObject.pointProperty.x"); + QCOMPARE(p.isValid(), true); + + p.write(14); + QCOMPARE(p.read(), QVariant(14)); +} + void tst_qqmlproperty::initTestCase() { QQmlDataTest::initTestCase(); |