Commit fa3ef537 authored by Michael Brasser's avatar Michael Brasser Committed by Qt by Nokia

Use QQmlAbstractBoundSignal where appropriate.

Prepare for the addition of another subclass.

Change-Id: I340f735503e661d9d735f3316a065f807294921b
Reviewed-by: 's avatarChris Adams <christopher.adams@nokia.com>
parent a329f246
......@@ -223,7 +223,7 @@ void QQmlEngineDebugService::buildObjectDump(QDataStream &message,
int childrenCount = children.count();
for (int ii = 0; ii < children.count(); ++ii) {
if (qobject_cast<QQmlContext*>(children[ii]) || QQmlBoundSignal::cast(children[ii]))
if (qobject_cast<QQmlContext*>(children[ii]) || qobject_cast<QQmlAbstractBoundSignal*>(children[ii]))
--childrenCount;
}
......@@ -235,7 +235,7 @@ void QQmlEngineDebugService::buildObjectDump(QDataStream &message,
QObject *child = children.at(ii);
if (qobject_cast<QQmlContext*>(child))
continue;
QQmlBoundSignal *signal = QQmlBoundSignal::cast(child);
QQmlAbstractBoundSignal *signal = qobject_cast<QQmlAbstractBoundSignal*>(child);
if (signal) {
if (!dumpProperties)
continue;
......
......@@ -161,12 +161,6 @@ QQmlExpression *QQmlBoundSignal::setExpression(QQmlExpression *e)
return rv;
}
QQmlBoundSignal *QQmlBoundSignal::cast(QObject *o)
{
QQmlAbstractBoundSignal *s = qobject_cast<QQmlAbstractBoundSignal*>(o);
return static_cast<QQmlBoundSignal *>(s);
}
int QQmlBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a)
{
if (c == QMetaObject::InvokeMetaMethod && id == evaluateIdx) {
......
......@@ -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);
......
......@@ -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);
......
......@@ -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<QQmlAbstractBoundSignal*>(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<QQmlAbstractBoundSignal*>(child);
if (signal && signal->index() == that.index())
return signal->setExpression(expr);
}
......
......@@ -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<QQmlBoundSignal*> signalHandlers =
o->findChildren<QQmlBoundSignal*>();
QList<QQmlAbstractBoundSignal*> signalHandlers =
o->findChildren<QQmlAbstractBoundSignal*>();
QString signal = p.value.toString();
bool found = false;
for (int i = 0; i < signalHandlers.count(); ++i)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment