Add a signal emitted callback to QAbstractDeclarativeData

For property notify signals, QtDeclarative can manage connections
in a more special case - and more performant - way.  This patch
adds a callback hook so that QtDeclarative can intercept signals
being emitted by declarative objects.

Change-Id: I72554e80df0a4257da65d81cc1c5db88a11446a4
Reviewed-on: http://codereview.qt.nokia.com/3363
Reviewed-by: Martin Jones <martin.jones@nokia.com>
This commit is contained in:
Aaron Kennedy 2011-08-19 22:05:50 +10:00 committed by Qt by Nokia
parent 10eb62b71b
commit 009f3d1404
2 changed files with 6 additions and 0 deletions

View File

@ -147,6 +147,7 @@ private:
void (*QAbstractDeclarativeData::destroyed)(QAbstractDeclarativeData *, QObject *) = 0;
void (*QAbstractDeclarativeData::parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *) = 0;
void (*QAbstractDeclarativeData::objectNameChanged)(QAbstractDeclarativeData *, QObject *) = 0;
void (*QAbstractDeclarativeData::signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **) = 0;
QObjectData::~QObjectData() {}
@ -3270,6 +3271,10 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
int signal_index = signalOffset + local_signal_index;
if (sender->d_func()->declarativeData && QAbstractDeclarativeData::signalEmitted)
QAbstractDeclarativeData::signalEmitted(sender->d_func()->declarativeData, sender,
methodOffset + local_signal_index, argv);
if (!sender->d_func()->isSignalConnected(signal_index))
return; // nothing connected to these signals, and no spy

View File

@ -91,6 +91,7 @@ public:
static void (*destroyed)(QAbstractDeclarativeData *, QObject *);
static void (*parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *);
static void (*objectNameChanged)(QAbstractDeclarativeData *, QObject *);
static void (*signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **);
};
class Q_CORE_EXPORT QObjectPrivate : public QObjectData