From c421281a0291fd48c616a6e37315364ce0553c0f Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Sun, 3 Jun 2012 21:10:32 +0200 Subject: Adapt to connection-related changes in qtbase The QQmlData hooks signalEmitted() and receivers() now receive the index in the signal index range (i.e., excluding non-signal methods). This was done to avoid Q(Meta)Object having to compute the class's method offset; the signal offset should be sufficient for everyone. This required adapting QQmlNotifier, QQmlBoundSignal, QQmlPropertyCache and friends to use the signal index range whenever a property's notify signal is involved in the internal connection lists and property captures. Using the signal index range also reduces the memory used for NotifyList::notifies, since useless entries for non-signal methods will no longer be created. Change-Id: I62872fbea5a1f829b8b03bae3fc1e6acd84cf886 Reviewed-by: Aaron Kennedy --- src/qml/qml/qqmlcontext.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/qml/qml/qqmlcontext.cpp') diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp index a02b2b7dd4..153d8886c3 100644 --- a/src/qml/qml/qqmlcontext.cpp +++ b/src/qml/qml/qqmlcontext.cpp @@ -53,6 +53,7 @@ #include #include +#include #include QT_BEGIN_NAMESPACE @@ -289,7 +290,7 @@ void QQmlContext::setContextProperty(const QString &name, const QVariant &value) { Q_D(QQmlContext); if (d->notifyIndex == -1) - d->notifyIndex = this->metaObject()->methodCount(); + d->notifyIndex = QMetaObjectPrivate::absoluteSignalCount(&QQmlContext::staticMetaObject); QQmlContextData *data = d->data; @@ -322,7 +323,7 @@ void QQmlContext::setContextProperty(const QString &name, const QVariant &value) data->refreshExpressions(); } else { d->propertyValues[idx] = value; - QMetaObject::activate(this, idx + d->notifyIndex, 0); + QMetaObject::activate(this, d->notifyIndex, idx, 0); } } @@ -335,7 +336,7 @@ void QQmlContext::setContextProperty(const QString &name, QObject *value) { Q_D(QQmlContext); if (d->notifyIndex == -1) - d->notifyIndex = this->metaObject()->methodCount(); + d->notifyIndex = QMetaObjectPrivate::absoluteSignalCount(&QQmlContext::staticMetaObject); QQmlContextData *data = d->data; @@ -359,7 +360,7 @@ void QQmlContext::setContextProperty(const QString &name, QObject *value) data->refreshExpressions(); } else { d->propertyValues[idx] = QVariant::fromValue(value); - QMetaObject::activate(this, idx + d->notifyIndex, 0); + QMetaObject::activate(this, d->notifyIndex, idx, 0); } } -- cgit v1.2.3