From: Michael Brasser Date: Wed, 21 Mar 2012 06:28:32 +0000 (+1000) Subject: Use QQmlAbstractBoundSignal where appropriate. X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=fa3ef5376acc69b147718f49eddb842fdd5d2dd2;p=konrad%2Fqtdeclarative.git Use QQmlAbstractBoundSignal where appropriate. Prepare for the addition of another subclass. Change-Id: I340f735503e661d9d735f3316a065f807294921b Reviewed-by: Chris Adams --- diff --git a/src/qml/debugger/qqmlenginedebugservice.cpp b/src/qml/debugger/qqmlenginedebugservice.cpp index 40af773..4bd8753 100644 --- a/src/qml/debugger/qqmlenginedebugservice.cpp +++ b/src/qml/debugger/qqmlenginedebugservice.cpp @@ -223,7 +223,7 @@ void QQmlEngineDebugService::buildObjectDump(QDataStream &message, int childrenCount = children.count(); for (int ii = 0; ii < children.count(); ++ii) { - if (qobject_cast(children[ii]) || QQmlBoundSignal::cast(children[ii])) + if (qobject_cast(children[ii]) || qobject_cast(children[ii])) --childrenCount; } @@ -235,7 +235,7 @@ void QQmlEngineDebugService::buildObjectDump(QDataStream &message, QObject *child = children.at(ii); if (qobject_cast(child)) continue; - QQmlBoundSignal *signal = QQmlBoundSignal::cast(child); + QQmlAbstractBoundSignal *signal = qobject_cast(child); if (signal) { if (!dumpProperties) continue; diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp index 543b69a..f8015a5 100644 --- a/src/qml/qml/qqmlboundsignal.cpp +++ b/src/qml/qml/qqmlboundsignal.cpp @@ -161,12 +161,6 @@ QQmlExpression *QQmlBoundSignal::setExpression(QQmlExpression *e) return rv; } -QQmlBoundSignal *QQmlBoundSignal::cast(QObject *o) -{ - QQmlAbstractBoundSignal *s = qobject_cast(o); - return static_cast(s); -} - int QQmlBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a) { if (c == QMetaObject::InvokeMetaMethod && id == evaluateIdx) { diff --git a/src/qml/qml/qqmlboundsignal_p.h b/src/qml/qml/qqmlboundsignal_p.h index 1138615..ab14de0 100644 --- a/src/qml/qml/qqmlboundsignal_p.h +++ b/src/qml/qml/qqmlboundsignal_p.h @@ -67,6 +67,10 @@ class Q_QML_EXPORT QQmlAbstractBoundSignal : public QObject public: QQmlAbstractBoundSignal(QObject *parent = 0); virtual ~QQmlAbstractBoundSignal() = 0; + + virtual int index() const = 0; + virtual QQmlExpression *expression() const = 0; + virtual QQmlExpression *setExpression(QQmlExpression *) = 0; }; class QQmlBoundSignalParameters; @@ -85,8 +89,6 @@ public: bool isEvaluating() const { return m_isEvaluating; } - static QQmlBoundSignal *cast(QObject *); - protected: virtual int qt_metacall(QMetaObject::Call c, int id, void **a); diff --git a/src/qml/qml/qqmlcontext.h b/src/qml/qml/qqmlcontext.h index f6d8aa1..4b11095 100644 --- a/src/qml/qml/qqmlcontext.h +++ b/src/qml/qml/qqmlcontext.h @@ -98,7 +98,6 @@ private: friend class QQmlComponent; friend class QQmlComponentPrivate; friend class QQmlScriptPrivate; - friend class QQmlBoundSignalProxy; friend class QQmlContextData; QQmlContext(QQmlContextData *); QQmlContext(QQmlEngine *, bool); diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp index 14778ce..ebcf903 100644 --- a/src/qml/qml/qqmlproperty.cpp +++ b/src/qml/qml/qqmlproperty.cpp @@ -928,7 +928,7 @@ QQmlPropertyPrivate::signalExpression(const QQmlProperty &that) for (int ii = 0; ii < children.count(); ++ii) { QObject *child = children.at(ii); - QQmlBoundSignal *signal = QQmlBoundSignal::cast(child); + QQmlAbstractBoundSignal *signal = qobject_cast(child); if (signal && signal->index() == that.index()) return signal->expression(); } @@ -957,7 +957,7 @@ QQmlPropertyPrivate::setSignalExpression(const QQmlProperty &that, for (int ii = 0; ii < children.count(); ++ii) { QObject *child = children.at(ii); - QQmlBoundSignal *signal = QQmlBoundSignal::cast(child); + QQmlAbstractBoundSignal *signal = qobject_cast(child); if (signal && signal->index() == that.index()) return signal->setExpression(expr); } diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp index e84e662..d082593 100644 --- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp +++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp @@ -202,10 +202,10 @@ void tst_QQmlEngineDebugService::recursiveObjectTest( foreach (const QmlDebugPropertyReference &p, oref.properties) { QCOMPARE(p.objectDebugId, QQmlDebugService::idForObject(o)); - // signal properties are fake - they are generated from QQmlBoundSignal children + // signal properties are fake - they are generated from QQmlAbstractBoundSignal children if (p.name.startsWith("on") && p.name.length() > 2 && p.name[2].isUpper()) { - QList signalHandlers = - o->findChildren(); + QList signalHandlers = + o->findChildren(); QString signal = p.value.toString(); bool found = false; for (int i = 0; i < signalHandlers.count(); ++i)