From 50f700aa8f68fff1e0153d19227b5a0bebbb6e51 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 22 Feb 2018 16:04:08 +0100 Subject: Fix group property bindings for aliases that point to id objects When declaring bindings within a group property and that group property itself is a locally declared alias, then by the time we try to determine property caches for the group property we will fail as the aliases haven't been resolved yet. To fix this we can keep track of such group property declarations (encapsulated in the QQmlInstantiatingBindingContext that has all we need) and after we've resolved the aliases (added them to the property caches), we can go back and fill in the entries in the propertyCaches array for the group properties. Task-number: QTBUG-51043 Change-Id: I5613513db3977934bcc51a3df530de47d57326f9 Reviewed-by: Mitch Curtis Reviewed-by: Michael Brasser --- tests/auto/qml/qqmllanguage/data/alias.15.qml | 12 ++++++++++++ tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 14 ++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 tests/auto/qml/qqmllanguage/data/alias.15.qml (limited to 'tests/auto') diff --git a/tests/auto/qml/qqmllanguage/data/alias.15.qml b/tests/auto/qml/qqmllanguage/data/alias.15.qml new file mode 100644 index 0000000000..5f3de9c83e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/alias.15.qml @@ -0,0 +1,12 @@ +import QtQuick 2.6 + +Item { + id: root + + property alias symbol: symbol + symbol.y: 1 + + Item { + id: symbol + } +} diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 952e4a22a1..5bb2b69565 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -1892,6 +1892,20 @@ void tst_qqmllanguage::aliasProperties() QVERIFY(subObject->property("success").toBool()); } + + // Property bindings on group properties that are actually aliases (QTBUG-51043) + { + QQmlComponent component(&engine, testFileUrl("alias.15.qml")); + VERIFY_ERRORS(0); + + QScopedPointer object(component.create()); + QVERIFY(!object.isNull()); + + QPointer subItem = qvariant_cast(object->property("symbol")); + QVERIFY(!subItem.isNull()); + + QCOMPARE(subItem->property("y").toInt(), 1); + } } // QTBUG-13374 Test that alias properties and signals can coexist -- cgit v1.2.3