aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2012-04-05 13:30:00 +1000
committerQt by Nokia <qt-info@nokia.com>2012-04-20 04:09:37 +0200
commit955bac49404590e88360f855207d88eb21925a6d (patch)
tree22077edefe1e2b2749b3a2e809aa4a4eba2aaeb8 /src
parent22408c96cdf4597c410fcde1d01df9f8c53fd8c8 (diff)
Provide receivers count from QQmlData.
Change-Id: I70b06507158797df3083dc23a119935497aa19f4 Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/qml/qml/qqmldata_p.h3
-rw-r--r--src/qml/qml/qqmlengine.cpp19
2 files changed, 22 insertions, 0 deletions
diff --git a/src/qml/qml/qqmldata_p.h b/src/qml/qml/qqmldata_p.h
index 3dd1c3ccba..b8eee47750 100644
--- a/src/qml/qml/qqmldata_p.h
+++ b/src/qml/qml/qqmldata_p.h
@@ -91,12 +91,14 @@ public:
QAbstractDeclarativeData::parentChanged = parentChanged;
QAbstractDeclarativeData::objectNameChanged = objectNameChanged;
QAbstractDeclarativeData::signalEmitted = signalEmitted;
+ QAbstractDeclarativeData::receivers = receivers;
}
static void destroyed(QAbstractDeclarativeData *, QObject *);
static void parentChanged(QAbstractDeclarativeData *, QObject *, QObject *);
static void objectNameChanged(QAbstractDeclarativeData *, QObject *);
static void signalEmitted(QAbstractDeclarativeData *, QObject *, int, void **);
+ static int receivers(QAbstractDeclarativeData *, const QObject *, int);
void destroyed(QObject *);
void parentChanged(QObject *, QObject *);
@@ -130,6 +132,7 @@ public:
inline QQmlNotifierEndpoint *notify(int index);
void addNotify(int index, QQmlNotifierEndpoint *);
+ int endpointCount(int index);
// The context that created the C++ object
QQmlContextData *context;
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 153d6b325a..82eeb917ab 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -457,6 +457,25 @@ void QQmlData::signalEmitted(QAbstractDeclarativeData *, QObject *object, int in
if (ep) QQmlNotifier::emitNotify(ep);
}
+int QQmlData::receivers(QAbstractDeclarativeData *d, const QObject *, int index)
+{
+ return static_cast<QQmlData *>(d)->endpointCount(index);
+}
+
+int QQmlData::endpointCount(int index)
+{
+ int count = 0;
+ QQmlNotifierEndpoint *ep = notify(index);
+ if (!ep)
+ return count;
+ ++count;
+ while (ep->next) {
+ ++count;
+ ep = ep->next;
+ }
+ return count;
+}
+
void QQmlEnginePrivate::init()
{
Q_Q(QQmlEngine);