QQmlData *ddata = QQmlData::get(object);
if (ddata && ddata->signalHandlers) {
- QQmlAbstractBoundSignal *signalHandler = ddata->signalHandlers;
+ QQmlBoundSignal *signalHandler = ddata->signalHandlers;
while (signalHandler) {
QQmlObjectProperty prop;
////////////////////////////////////////////////////////////////////////
-QQmlAbstractBoundSignal::QQmlAbstractBoundSignal()
-: m_prevSignal(0), m_nextSignal(0)
+
+/*! \internal
+ \a signal MUST be in the signal index range (see QObjectPrivate::signalIndex()).
+ This is different from QMetaMethod::methodIndex().
+*/
+QQmlBoundSignal::QQmlBoundSignal(QObject *target, int signal, QObject *owner,
+ QQmlEngine *engine)
+ : m_prevSignal(0), m_nextSignal(0),
+ m_expression(0), m_index(signal), m_isEvaluating(false)
{
+ addToObject(owner);
+ setCallback(QQmlNotifierEndpoint::QQmlBoundSignal);
+
+ /*
+ If this is a cloned method, connect to the 'original'. For example,
+ for the signal 'void aSignal(int parameter = 0)', if the method
+ index refers to 'aSignal()', get the index of 'aSignal(int)'.
+ This ensures that 'parameter' will be available from QML.
+ */
+ m_index = QQmlPropertyCache::originalClone(target, m_index);
+ QQmlNotifierEndpoint::connect(target, m_index, engine);
}
-QQmlAbstractBoundSignal::~QQmlAbstractBoundSignal()
+QQmlBoundSignal::~QQmlBoundSignal()
{
removeFromObject();
+ m_expression = 0;
}
-void QQmlAbstractBoundSignal::addToObject(QObject *obj)
+void QQmlBoundSignal::addToObject(QObject *obj)
{
Q_ASSERT(!m_prevSignal);
Q_ASSERT(obj);
data->signalHandlers = this;
}
-void QQmlAbstractBoundSignal::removeFromObject()
+void QQmlBoundSignal::removeFromObject()
{
if (m_prevSignal) {
*m_prevSignal = m_nextSignal;
}
}
-/*! \internal
- \a signal MUST be in the signal index range (see QObjectPrivate::signalIndex()).
- This is different from QMetaMethod::methodIndex().
-*/
-QQmlBoundSignal::QQmlBoundSignal(QObject *target, int signal, QObject *owner,
- QQmlEngine *engine)
-: m_expression(0), m_index(signal), m_isEvaluating(false)
-{
- addToObject(owner);
- setCallback(QQmlNotifierEndpoint::QQmlBoundSignal);
-
- /*
- If this is a cloned method, connect to the 'original'. For example,
- for the signal 'void aSignal(int parameter = 0)', if the method
- index refers to 'aSignal()', get the index of 'aSignal(int)'.
- This ensures that 'parameter' will be available from QML.
- */
- m_index = QQmlPropertyCache::originalClone(target, m_index);
- QQmlNotifierEndpoint::connect(target, m_index, engine);
-}
-
-QQmlBoundSignal::~QQmlBoundSignal()
-{
- m_expression = 0;
-}
/*!
Returns the signal index in the range returned by QObjectPrivate::signalIndex().
QFlagPointer<ExtraData> m_extra;
};
-class Q_QML_PRIVATE_EXPORT QQmlAbstractBoundSignal
-{
-public:
- QQmlAbstractBoundSignal();
- virtual ~QQmlAbstractBoundSignal();
-
- virtual int index() const = 0;
- virtual QQmlBoundSignalExpression *expression() const = 0;
- virtual QQmlBoundSignalExpressionPointer setExpression(QQmlBoundSignalExpression *) = 0;
- virtual QQmlBoundSignalExpressionPointer takeExpression(QQmlBoundSignalExpression *) = 0;
- virtual bool isEvaluating() const = 0;
-
- void removeFromObject();
-protected:
- void addToObject(QObject *owner);
-
-private:
- friend class QQmlData;
- friend class QQmlPropertyPrivate;
- friend class QQmlEngineDebugService;
- QQmlAbstractBoundSignal **m_prevSignal;
- QQmlAbstractBoundSignal *m_nextSignal;
-};
-
-class Q_QML_PRIVATE_EXPORT QQmlBoundSignal : public QQmlAbstractBoundSignal,
- public QQmlNotifierEndpoint
+class Q_QML_PRIVATE_EXPORT QQmlBoundSignal : public QQmlNotifierEndpoint
{
public:
QQmlBoundSignal(QObject *target, int signal, QObject *owner, QQmlEngine *engine);
virtual ~QQmlBoundSignal();
+ void removeFromObject();
+
int index() const;
QQmlBoundSignalExpression *expression() const;
private:
friend void QQmlBoundSignal_callback(QQmlNotifierEndpoint *, void **);
+ friend class QQmlPropertyPrivate;
+ friend class QQmlData;
+ friend class QQmlEngineDebugService;
+
+ void addToObject(QObject *owner);
+
+ QQmlBoundSignal **m_prevSignal;
+ QQmlBoundSignal *m_nextSignal;
QQmlBoundSignalExpressionPointer m_expression;
int m_index;
class QQmlGuardImpl;
class QQmlCompiledData;
class QQmlAbstractBinding;
-class QQmlAbstractBoundSignal;
+class QQmlBoundSignal;
class QQmlContext;
class QQmlPropertyCache;
class QQmlContextData;
QQmlContextData *outerContext;
QQmlAbstractBinding *bindings;
- QQmlAbstractBoundSignal *signalHandlers;
+ QQmlBoundSignal *signalHandlers;
// Linked list for QQmlContext::contextObjects
QQmlData *nextContextObject;
deferredData = 0;
}
- QQmlAbstractBoundSignal *signalHandler = signalHandlers;
+ QQmlBoundSignal *signalHandler = signalHandlers;
while (signalHandler) {
if (signalHandler->isEvaluating()) {
// The object is being deleted during signal handler evaluation.
"%s", object, qPrintable(locationString));
}
- QQmlAbstractBoundSignal *next = signalHandler->m_nextSignal;
+ QQmlBoundSignal *next = signalHandler->m_nextSignal;
signalHandler->m_prevSignal = 0;
signalHandler->m_nextSignal = 0;
delete signalHandler;
if (!data)
return 0;
- QQmlAbstractBoundSignal *signalHandler = data->signalHandlers;
+ QQmlBoundSignal *signalHandler = data->signalHandlers;
while (signalHandler && signalHandler->index() != QQmlPropertyPrivate::get(that)->signalIndex())
signalHandler = signalHandler->m_nextSignal;
if (!data)
return 0;
- QQmlAbstractBoundSignal *signalHandler = data->signalHandlers;
+ QQmlBoundSignal *signalHandler = data->signalHandlers;
while (signalHandler && signalHandler->index() != QQmlPropertyPrivate::get(that)->signalIndex())
signalHandler = signalHandler->m_nextSignal;