summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativeproperty.cpp
diff options
context:
space:
mode:
authorMorten Engvoldsen <morten.engvoldsen@nokia.com>2010-10-09 15:33:38 (GMT)
committerMorten Engvoldsen <morten.engvoldsen@nokia.com>2010-10-09 15:33:38 (GMT)
commitb4ddf0420db30098274986612ca3e8951ef18e2e (patch)
treea85bdad9b92652b09dd613b2172d5b07d4926d4b /src/declarative/qml/qdeclarativeproperty.cpp
parent612a7680e10eb434cd6e09a2165ab1b75efdb72a (diff)
parente1fead7c4f877308c2cc11131c445a1f7085baf7 (diff)
downloadQt-b4ddf0420db30098274986612ca3e8951ef18e2e.zip
Qt-b4ddf0420db30098274986612ca3e8951ef18e2e.tar.gz
Qt-b4ddf0420db30098274986612ca3e8951ef18e2e.tar.bz2
Merge branch '4.7' into mimir
Diffstat (limited to 'src/declarative/qml/qdeclarativeproperty.cpp')
-rw-r--r--src/declarative/qml/qdeclarativeproperty.cpp56
1 files changed, 55 insertions, 1 deletions
diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp
index bc20bff..b5fb619 100644
--- a/src/declarative/qml/qdeclarativeproperty.cpp
+++ b/src/declarative/qml/qdeclarativeproperty.cpp
@@ -53,6 +53,7 @@
#include "private/qdeclarativestringconverters_p.h"
#include "private/qdeclarativelist_p.h"
#include "private/qdeclarativecompiler_p.h"
+#include "private/qdeclarativevmemetaobject_p.h"
#include <QStringList>
#include <QtCore/qdebug.h>
@@ -1212,7 +1213,7 @@ bool QDeclarativeProperty::connectNotifySignal(QObject *dest, int method) const
QMetaProperty prop = d->object->metaObject()->property(d->core.coreIndex);
if (prop.hasNotifySignal()) {
- return QMetaObject::connect(d->object, prop.notifySignalIndex(), dest, method, Qt::DirectConnection);
+ return QDeclarativePropertyPrivate::connect(d->object, prop.notifySignalIndex(), dest, method, Qt::DirectConnection);
} else {
return false;
}
@@ -1383,4 +1384,57 @@ QMetaMethod QDeclarativePropertyPrivate::findSignalByName(const QMetaObject *mo,
return QMetaMethod();
}
+static inline int QMetaObject_methods(const QMetaObject *metaObject)
+{
+ struct Private
+ {
+ int revision;
+ int className;
+ int classInfoCount, classInfoData;
+ int methodCount, methodData;
+ };
+
+ return reinterpret_cast<const Private *>(metaObject->d.data)->methodCount;
+}
+
+static inline void flush_vme_signal(const QObject *object, int index)
+{
+ QDeclarativeData *data = static_cast<QDeclarativeData *>(QObjectPrivate::get(const_cast<QObject *>(object))->declarativeData);
+ if (data && data->propertyCache) {
+ QDeclarativePropertyCache::Data *property = data->propertyCache->method(index);
+
+ if (property && property->flags & QDeclarativePropertyCache::Data::IsVMESignal) {
+ const QMetaObject *metaObject = object->metaObject();
+ int methodOffset = metaObject->methodOffset();
+
+ while (methodOffset > index) {
+ methodOffset -= QMetaObject_methods(metaObject);
+ metaObject = metaObject->d.superdata;
+ }
+
+ QDeclarativeVMEMetaObject *vme =
+ static_cast<QDeclarativeVMEMetaObject *>(const_cast<QMetaObject *>(metaObject));
+
+ vme->connectAliasSignal(index);
+ }
+ }
+}
+
+/*!
+Connect \a sender \a signal_index to \a receiver \a method_index with the specified
+\a type and \a types. This behaves identically to QMetaObject::connect() except that
+it connects any lazy "proxy" signal connections set up by QML.
+
+It is possible that this logic should be moved to QMetaObject::connect().
+*/
+bool QDeclarativePropertyPrivate::connect(const QObject *sender, int signal_index,
+ const QObject *receiver, int method_index,
+ int type, int *types)
+{
+ flush_vme_signal(sender, signal_index);
+ flush_vme_signal(receiver, method_index);
+
+ return QMetaObject::connect(sender, signal_index, receiver, method_index, type, types);
+}
+
QT_END_NAMESPACE