diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2012-06-03 21:10:32 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-12 12:06:09 +0200 |
commit | c421281a0291fd48c616a6e37315364ce0553c0f (patch) | |
tree | da71d664288d4aaaf3836a03c0c1d645a81670ea /src/qml/qml/qqmlboundsignal.cpp | |
parent | f4a683f6874b03ce3e0a2869320a9956d5a04098 (diff) |
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 <aaron.kennedy@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlboundsignal.cpp')
-rw-r--r-- | src/qml/qml/qqmlboundsignal.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp index 7ed723048f..3713de9270 100644 --- a/src/qml/qml/qqmlboundsignal.cpp +++ b/src/qml/qml/qqmlboundsignal.cpp @@ -41,6 +41,7 @@ #include "qqmlboundsignal_p.h" +#include <private/qmetaobject_p.h> #include <private/qmetaobjectbuilder_p.h> #include "qqmlengine_p.h" #include "qqmlexpression_p.h" @@ -242,6 +243,10 @@ void QQmlAbstractBoundSignal::removeFromObject() } } +/*! \internal + \a signal MUST be in the signal index range (see QObjectPrivate::signalIndex()). + This is different from QMetaMethod::methodIndex(). +*/ QQmlBoundSignal::QQmlBoundSignal(QObject *scope, int signal, QObject *owner, QQmlEngine *engine) : m_expression(0), m_params(0), m_scope(scope), m_index(signal) @@ -259,10 +264,10 @@ QQmlBoundSignal::QQmlBoundSignal(QObject *scope, int signal, QObject *owner, */ if (QQmlData::get(scope, false) && QQmlData::get(scope, false)->propertyCache) { QQmlPropertyCache *cache = QQmlData::get(scope, false)->propertyCache; - while (cache->method(m_index)->isCloned()) + while (cache->signal(m_index)->isCloned()) --m_index; } else { - while (scope->metaObject()->method(m_index).attributes() & QMetaMethod::Cloned) + while (QMetaObjectPrivate::signal(scope->metaObject(), m_index).attributes() & QMetaMethod::Cloned) --m_index; } @@ -275,6 +280,10 @@ QQmlBoundSignal::~QQmlBoundSignal() delete m_params; } +/*! + Returns the signal index in the range returned by QObjectPrivate::signalIndex(). + This is different from QMetaMethod::methodIndex(). +*/ int QQmlBoundSignal::index() const { return m_index; @@ -325,16 +334,16 @@ void QQmlBoundSignal_callback(QQmlNotifierEndpoint *e, void **a) return; if (QQmlDebugService::isDebuggingEnabled()) - QV8DebugService::instance()->signalEmitted(QString::fromLatin1(s->m_scope->metaObject()->method(s->m_index).methodSignature())); + QV8DebugService::instance()->signalEmitted(QString::fromLatin1(QMetaObjectPrivate::signal(s->m_scope->metaObject(), s->m_index).methodSignature())); QQmlHandlingSignalProfiler prof(s->m_expression); s->setIsEvaluating(true); if (!s->paramsValid()) { - QList<QByteArray> names = QQmlPropertyCache::methodParameterNames(*s->m_scope, s->m_index); + QList<QByteArray> names = QQmlPropertyCache::signalParameterNames(*s->m_scope, s->m_index); if (!names.isEmpty()) { - QMetaMethod signal = s->m_scope->metaObject()->method(s->m_index); + QMetaMethod signal = QMetaObjectPrivate::signal(s->m_scope->metaObject(), s->m_index); s->m_params = new QQmlBoundSignalParameters(signal, s); } |