Use the existing endpoint object to connect alias notify signals
authorAaron Kennedy <aaron.kennedy@nokia.com>
Mon, 13 Feb 2012 16:14:53 +0000 (16:14 +0000)
committerQt by Nokia <qt-info@nokia.com>
Mon, 20 Feb 2012 07:34:28 +0000 (08:34 +0100)
Change-Id: I891ea5e3854a4fc92ba59e98417ad72774bd7adb
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
src/declarative/qml/qdeclarativevmemetaobject.cpp

index 36a8838..d9ad56a 100644 (file)
@@ -406,27 +406,27 @@ void QDeclarativeVMEMetaObjectEndpoint::vmecallback(QDeclarativeNotifierEndpoint
 
 void QDeclarativeVMEMetaObjectEndpoint::tryConnect()
 {
-    if (metaObject.flag())
-        return;
-
     int aliasId = this - metaObject->aliasEndpoints;
 
-    QDeclarativeVMEMetaData::AliasData *d = metaObject->metaData->aliasData() + aliasId;
-    if (!d->isObjectAlias()) {
-        QDeclarativeContextData *ctxt = metaObject->ctxt;
-        QObject *target = ctxt->idValues[d->contextIdx].data();
-        if (!target)
-            return;
-
-        QMetaProperty prop = target->metaObject()->property(d->propertyIndex());
-        if (prop.hasNotifySignal()) {
-            int sigIdx = metaObject->methodOffset + aliasId + metaObject->metaData->propertyCount;
-            QDeclarativePropertyPrivate::connect(target, prop.notifySignalIndex(),
-                                                 metaObject->object, sigIdx);
+    if (metaObject.flag()) {
+        // This is actually notify
+        int sigIdx = metaObject->methodOffset + aliasId + metaObject->metaData->propertyCount;
+        QMetaObject::activate(metaObject->object, sigIdx, 0);
+    } else {
+        QDeclarativeVMEMetaData::AliasData *d = metaObject->metaData->aliasData() + aliasId;
+        if (!d->isObjectAlias()) {
+            QDeclarativeContextData *ctxt = metaObject->ctxt;
+            QObject *target = ctxt->idValues[d->contextIdx].data();
+            if (!target)
+                return;
+
+            QMetaProperty prop = target->metaObject()->property(d->propertyIndex());
+            if (prop.hasNotifySignal())
+                connect(target, prop.notifySignalIndex());
         }
-    }
 
-    metaObject.setFlag();
+        metaObject.setFlag();
+    }
 }
 
 QDeclarativeVMEMetaObject::QDeclarativeVMEMetaObject(QObject *obj,