summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-08-24 14:34:49 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-08-24 16:03:07 (GMT)
commitaf2b28f9ca070576ed465f17516fdb9a004b83a4 (patch)
tree31debbe6a6679563db45000f60f31b20212ca066 /src/declarative
parente9e6be0de1e1691b9d10cc9524aabf5d493858d6 (diff)
downloadQt-af2b28f9ca070576ed465f17516fdb9a004b83a4.zip
Qt-af2b28f9ca070576ed465f17516fdb9a004b83a4.tar.gz
Qt-af2b28f9ca070576ed465f17516fdb9a004b83a4.tar.bz2
QDeclarativeDebug: send a message when new object are added
Reviewed-by: Lasse Holmstedt
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/debugger/qdeclarativedebug.cpp2
-rw-r--r--src/declarative/debugger/qdeclarativedebug_p.h3
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp8
-rw-r--r--src/declarative/qml/qdeclarativeenginedebug.cpp15
-rw-r--r--src/declarative/qml/qdeclarativeenginedebug_p.h1
5 files changed, 27 insertions, 2 deletions
diff --git a/src/declarative/debugger/qdeclarativedebug.cpp b/src/declarative/debugger/qdeclarativedebug.cpp
index 154df51..1ffe441 100644
--- a/src/declarative/debugger/qdeclarativedebug.cpp
+++ b/src/declarative/debugger/qdeclarativedebug.cpp
@@ -340,6 +340,8 @@ void QDeclarativeEngineDebugPrivate::message(const QByteArray &data)
if (!watch)
return;
emit watch->valueChanged(name, value);
+ } else if (type == "OBJECT_CREATED") {
+ emit q_func()->newObjects();
}
}
diff --git a/src/declarative/debugger/qdeclarativedebug_p.h b/src/declarative/debugger/qdeclarativedebug_p.h
index 2e79c5d..f0fc488 100644
--- a/src/declarative/debugger/qdeclarativedebug_p.h
+++ b/src/declarative/debugger/qdeclarativedebug_p.h
@@ -99,6 +99,9 @@ public:
bool resetBindingForObject(int objectDebugId, const QString &propertyName);
bool setMethodBody(int objectDebugId, const QString &methodName, const QString &methodBody);
+Q_SIGNALS:
+ void newObjects();
+
private:
Q_DECLARE_PRIVATE(QDeclarativeEngineDebug)
};
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index 15cef16..d2d1f19 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -54,6 +54,7 @@
#include "private/qdeclarativeglobal_p.h"
#include "private/qdeclarativescriptparser_p.h"
#include "private/qdeclarativedebugtrace_p.h"
+#include "private/qdeclarativeenginedebug_p.h"
#include <QStack>
#include <QStringList>
@@ -765,8 +766,11 @@ QDeclarativeComponentPrivate::beginCreate(QDeclarativeContextData *context, cons
QObject *rv = begin(ctxt, ep, cc, start, count, &state, bindings);
- if (rv && !context->isInternal && ep->isDebugging)
- context->asQDeclarativeContextPrivate()->instances.append(rv);
+ if (ep->isDebugging && rv) {
+ if (!context->isInternal)
+ context->asQDeclarativeContextPrivate()->instances.append(rv);
+ QDeclarativeEngineDebugServer::instance()->objectCreated(engine, rv);
+ }
return rv;
}
diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp
index 056d8a0..ed28185 100644
--- a/src/declarative/qml/qdeclarativeenginedebug.cpp
+++ b/src/declarative/qml/qdeclarativeenginedebug.cpp
@@ -604,4 +604,19 @@ void QDeclarativeEngineDebugServer::remEngine(QDeclarativeEngine *engine)
m_engines.removeAll(engine);
}
+void QDeclarativeEngineDebugServer::objectCreated(QDeclarativeEngine *engine, QObject *object)
+{
+ Q_ASSERT(engine);
+ Q_ASSERT(m_engines.contains(engine));
+
+ int engineId = QDeclarativeDebugService::idForObject(engine);
+ int objectId = QDeclarativeDebugService::idForObject(object);
+
+ QByteArray reply;
+ QDataStream rs(&reply, QIODevice::WriteOnly);
+
+ rs << QByteArray("OBJECT_CREATED") << engineId << objectId;
+ sendMessage(reply);
+}
+
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativeenginedebug_p.h b/src/declarative/qml/qdeclarativeenginedebug_p.h
index 4704393..613f1fe 100644
--- a/src/declarative/qml/qdeclarativeenginedebug_p.h
+++ b/src/declarative/qml/qdeclarativeenginedebug_p.h
@@ -94,6 +94,7 @@ public:
void addEngine(QDeclarativeEngine *);
void remEngine(QDeclarativeEngine *);
+ void objectCreated(QDeclarativeEngine *, QObject *);
static QDeclarativeEngineDebugServer *instance();