From e92730ceebb4aa96704052236d45938a82c03dd8 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 19 Oct 2010 14:29:57 +1000 Subject: Call the correct vme meta object when connecting alias signals Task-number: QTCREATORBUG-2769 --- src/declarative/qml/qdeclarativeproperty.cpp | 2 +- .../data/AliasPropertyChangeSignalsType.qml | 20 ++++++++++++++++ .../data/aliasPropertyChangeSignals.2.qml | 10 ++++++++ .../tst_qdeclarativelanguage.cpp | 27 +++++++++++++++++----- 4 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/AliasPropertyChangeSignalsType.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/aliasPropertyChangeSignals.2.qml diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index b5fb619..1395e97 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -1408,8 +1408,8 @@ static inline void flush_vme_signal(const QObject *object, int index) int methodOffset = metaObject->methodOffset(); while (methodOffset > index) { - methodOffset -= QMetaObject_methods(metaObject); metaObject = metaObject->d.superdata; + methodOffset -= QMetaObject_methods(metaObject); } QDeclarativeVMEMetaObject *vme = diff --git a/tests/auto/declarative/qdeclarativelanguage/data/AliasPropertyChangeSignalsType.qml b/tests/auto/declarative/qdeclarativelanguage/data/AliasPropertyChangeSignalsType.qml new file mode 100644 index 0000000..0bc2025 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/AliasPropertyChangeSignalsType.qml @@ -0,0 +1,20 @@ +import QtQuick 1.0 + +QtObject { + id: root + + signal sig1 + signal sig2 + signal sig3 + signal sig4 + + property alias aliasProperty: root.realProperty + + property int realProperty: 0 + + property bool test: false + + Component.onCompleted: { + root.realProperty = 10; + } +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/aliasPropertyChangeSignals.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/aliasPropertyChangeSignals.2.qml new file mode 100644 index 0000000..a15a718 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/aliasPropertyChangeSignals.2.qml @@ -0,0 +1,10 @@ +import QtQuick 1.0 + +AliasPropertyChangeSignalsType { + id: root + onAliasPropertyChanged: root.test = true + + function blah() {} + property int a +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 061ac48..2aa5e0a 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -1890,15 +1890,30 @@ void tst_qdeclarativelanguage::initTestCase() void tst_qdeclarativelanguage::aliasPropertyChangeSignals() { - QDeclarativeComponent component(&engine, TEST_FILE("aliasPropertyChangeSignals.qml")); + { + QDeclarativeComponent component(&engine, TEST_FILE("aliasPropertyChangeSignals.qml")); - VERIFY_ERRORS(0); - QObject *o = component.create(); - QVERIFY(o != 0); + VERIFY_ERRORS(0); + QObject *o = component.create(); + QVERIFY(o != 0); - QCOMPARE(o->property("test").toBool(), true); + QCOMPARE(o->property("test").toBool(), true); - delete o; + delete o; + } + + // QTCREATORBUG-2769 + { + QDeclarativeComponent component(&engine, TEST_FILE("aliasPropertyChangeSignals.2.qml")); + + VERIFY_ERRORS(0); + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test").toBool(), true); + + delete o; + } } QTEST_MAIN(tst_qdeclarativelanguage) -- cgit v0.12