diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2012-04-03 15:22:17 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-03 09:22:28 +0200 |
commit | 6793121396ca34ea6c2cbb0567ce0cd605a31acc (patch) | |
tree | 4d0eecceee6dab2840c4fad148b5695c09b358c0 /src/qml/qml/qqmlboundsignal.cpp | |
parent | 07d3b18a5fc0b6431cafef57c9df22696e27b805 (diff) |
Use scope, not owner to look up enums in QQmlBoundSignal.
With this, we no longer need to keep a pointer to the owner, so remove
it as well.
Change-Id: I0c38645b924bf5b0caadb46444cf6dd09abc1eb2
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlboundsignal.cpp')
-rw-r--r-- | src/qml/qml/qqmlboundsignal.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp index af63cb122d..3afeb03606 100644 --- a/src/qml/qml/qqmlboundsignal.cpp +++ b/src/qml/qml/qqmlboundsignal.cpp @@ -204,10 +204,9 @@ QQmlAbstractBoundSignal::~QQmlAbstractBoundSignal() } } -void QQmlAbstractBoundSignal::addToObject() +void QQmlAbstractBoundSignal::addToObject(QObject *obj) { Q_ASSERT(!m_prevSignal); - QObject *obj = object(); Q_ASSERT(obj); QQmlData *data = QQmlData::get(obj, true); @@ -220,13 +219,15 @@ void QQmlAbstractBoundSignal::addToObject() QQmlBoundSignal::QQmlBoundSignal(QObject *scope, const QMetaMethod &signal, QObject *owner) -: m_expression(0), m_signal(signal), m_paramsValid(false), m_isEvaluating(false), m_params(0), m_owner(owner) +: m_expression(0), m_params(0), m_scope(scope), m_signal(signal), m_paramsValid(false), m_isEvaluating(false) { // This is thread safe. Although it may be updated by two threads, they // will both set it to the same value - so the worst thing that can happen // is that they both do the work to figure it out. Boo hoo. if (evaluateIdx == -1) evaluateIdx = metaObject()->methodCount(); + addToObject(owner); + QQmlPropertyPrivate::connect(scope, m_signal.methodIndex(), this, evaluateIdx); } @@ -347,7 +348,7 @@ QQmlBoundSignalParameters::QQmlBoundSignalParameters(const QMetaMethod &method, if (scope == "Qt") meta = &QObject::staticQtMetaObject; else - meta = static_cast<QQmlBoundSignal*>(parent)->object()->metaObject(); + meta = static_cast<QQmlBoundSignal*>(parent)->scope()->metaObject(); for (int i = meta->enumeratorCount() - 1; i >= 0; --i) { QMetaEnum m = meta->enumerator(i); if ((m.name() == name) && (scope.isEmpty() || (m.scope() == scope))) { |