From 5adb406bddd8419c2987cec48eb86a0d4ca0260a Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 11 Dec 2014 21:18:00 -0600 Subject: Fix QQmlProperty to work correctly with deeply nested objects. Don't keep reusing the top-level object to look up nested properties. This allows code such as the following to work correctly: PropertyChanges { target: myObject textChild.font.pixelSize: 24 } Change-Id: I39e52dbc20d2409fc756a36e668fcf664eb1905f Reviewed-by: Brett Stottlemyer Reviewed-by: Simon Hausmann --- tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp') 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(); -- cgit v1.2.3