From 0bf08af2b945f10f44561ffa0abd6f89b093b376 Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Tue, 22 Nov 2011 09:13:21 +1000 Subject: Fix default property preventing signals from being emitted. Change the way connectAlias works so that even if the target for the connection is not available immediately, anything that is bound to it is notified when the target is changed. (Fix is authored by Aaron). Task-number: QTBUG-21580 Change-Id: Ida23c0e620069c50b123c71b5078929d4c7ec4e4 Reviewed-by: Martin Jones --- .../qdeclarativeecmascript/data/qtbug_21580.qml | 22 ++++++++++++++++++++++ .../tst_qdeclarativeecmascript.cpp | 13 +++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/qtbug_21580.qml (limited to 'tests') diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_21580.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_21580.qml new file mode 100644 index 0000000000..dc0066ba3f --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_21580.qml @@ -0,0 +1,22 @@ +import QtQuick 2.0 + +QtObject { + property bool test: false + + property list objects: [ + QtObject { + id: first + property alias myAlias: other.myProperty + onMyAliasChanged: if (myAlias == 20) test = true + }, + QtObject { + id: other + property real myProperty + } + ] + + Component.onCompleted: { + other.myProperty = 20; + } +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 7d9819b193..4c43a02e81 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -178,6 +178,7 @@ private slots: void sequenceConversionBindings(); void sequenceConversionCopy(); void qtbug_22464(); + void qtbug_21580(); void bug1(); void bug2(); void dynamicCreationCrash(); @@ -1656,6 +1657,18 @@ void tst_qdeclarativeecmascript::qtbug_22464() delete object; } +void tst_qdeclarativeecmascript::qtbug_21580() +{ + QDeclarativeComponent component(&engine, TEST_FILE("qtbug_21580.qml")); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test").toBool(), true); + + delete object; +} + // QTBUG-6781 void tst_qdeclarativeecmascript::bug1() { -- cgit v1.2.3