summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/declarative/debugger/qmldebug.cpp42
-rw-r--r--src/declarative/qml/qmlenginedebug.cpp56
-rw-r--r--src/declarative/qml/qmlenginedebug_p.h2
3 files changed, 75 insertions, 25 deletions
diff --git a/src/declarative/debugger/qmldebug.cpp b/src/declarative/debugger/qmldebug.cpp
index 5a8cda0..08d3d75 100644
--- a/src/declarative/debugger/qmldebug.cpp
+++ b/src/declarative/debugger/qmldebug.cpp
@@ -110,6 +110,15 @@ void QmlEngineDebugPrivate::decode(QDataStream &ds, QmlDebugObjectReference &o,
if (simple)
return;
+ int childCount;
+ bool recur;
+ ds >> childCount >> recur;
+
+ for (int ii = 0; ii < childCount; ++ii) {
+ o.m_children.append(QmlDebugObjectReference());
+ decode(ds, o.m_children.last(), !recur);
+ }
+
int propCount;
ds >> propCount;
@@ -122,25 +131,26 @@ void QmlEngineDebugPrivate::decode(QDataStream &ds, QmlDebugObjectReference &o,
prop.m_binding = data.binding;
prop.m_hasNotifySignal = data.hasNotifySignal;
prop.m_valueTypeName = data.valueTypeName;
- if (data.type == QmlEngineDebugServer::QmlObjectProperty::Basic
- || data.type == QmlEngineDebugServer::QmlObjectProperty::List) {
- prop.m_value = data.value;
- } else if (data.type == QmlEngineDebugServer::QmlObjectProperty::Object) {
- QmlDebugObjectReference obj;
- obj.m_debugId = prop.m_value.toInt();
- prop.m_value = qVariantFromValue(obj);
+ switch (data.type) {
+ case QmlEngineDebugServer::QmlObjectProperty::Basic:
+ case QmlEngineDebugServer::QmlObjectProperty::List:
+ case QmlEngineDebugServer::QmlObjectProperty::SignalProperty:
+ {
+ prop.m_value = data.value;
+ break;
+ }
+ case QmlEngineDebugServer::QmlObjectProperty::Object:
+ {
+ QmlDebugObjectReference obj;
+ obj.m_debugId = prop.m_value.toInt();
+ prop.m_value = qVariantFromValue(obj);
+ break;
+ }
+ case QmlEngineDebugServer::QmlObjectProperty::Unknown:
+ break;
}
o.m_properties << prop;
}
-
- int childCount;
- bool recur;
- ds >> childCount >> recur;
-
- for (int ii = 0; ii < childCount; ++ii) {
- o.m_children.append(QmlDebugObjectReference());
- decode(ds, o.m_children.last(), !recur);
- }
}
void QmlEngineDebugPrivate::decode(QDataStream &ds, QmlDebugContextReference &c)
diff --git a/src/declarative/qml/qmlenginedebug.cpp b/src/declarative/qml/qmlenginedebug.cpp
index 8629f3a..7fb8d36 100644
--- a/src/declarative/qml/qmlenginedebug.cpp
+++ b/src/declarative/qml/qmlenginedebug.cpp
@@ -155,21 +155,61 @@ void QmlEngineDebugServer::buildObjectDump(QDataStream &message,
QObject *object, bool recur)
{
message << objectData(object);
- message << object->metaObject()->propertyCount();
- for (int ii = 0; ii < object->metaObject()->propertyCount(); ++ii)
- message << propertyData(object, ii);
+ // Some children aren't added to an object until particular properties are read
+ // - e.g. child state objects aren't added until the 'states' property is read -
+ // but this should only affect internal objects that aren't shown by the
+ // debugger anyway.
QObjectList children = object->children();
- message << children.count() << recur;
+
+ int childrenCount = children.count();
+ for (int ii = 0; ii < children.count(); ++ii) {
+ if (QmlBoundSignal::cast(children[ii]))
+ --childrenCount;
+ }
+
+ message << childrenCount << recur;
+
+ QList<QmlObjectProperty> fakeProperties;
for (int ii = 0; ii < children.count(); ++ii) {
QObject *child = children.at(ii);
- if (recur)
- buildObjectDump(message, child, recur);
- else
- message << objectData(child);
+ QmlBoundSignal *signal = QmlBoundSignal::cast(child);
+ if (signal) {
+ QmlObjectProperty prop;
+ prop.type = QmlObjectProperty::SignalProperty;
+ prop.hasNotifySignal = false;
+ QmlExpression *expr = signal->expression();
+ if (expr) {
+ prop.value = expr->expression();
+ QObject *scope = expr->scopeObject();
+ if (scope) {
+ QString sig = scope->metaObject()->method(signal->index()).signature();
+ int lparen = sig.indexOf(QLatin1Char('('));
+ if (lparen >= 0) {
+ QString methodName = sig.mid(0, lparen);
+ prop.name = QLatin1String("on") + methodName[0].toUpper()
+ + methodName.mid(1);
+ }
+ }
+ }
+ fakeProperties << prop;
+ } else {
+ if (recur)
+ buildObjectDump(message, child, recur);
+ else
+ message << objectData(child);
+ }
}
+
+ message << (object->metaObject()->propertyCount() + fakeProperties.count());
+
+ for (int ii = 0; ii < object->metaObject()->propertyCount(); ++ii)
+ message << propertyData(object, ii);
+
+ for (int ii = 0; ii < fakeProperties.count(); ++ii)
+ message << fakeProperties[ii];
}
void QmlEngineDebugServer::buildObjectList(QDataStream &message,
diff --git a/src/declarative/qml/qmlenginedebug_p.h b/src/declarative/qml/qmlenginedebug_p.h
index a8572eb..7dbbbda 100644
--- a/src/declarative/qml/qmlenginedebug_p.h
+++ b/src/declarative/qml/qmlenginedebug_p.h
@@ -81,7 +81,7 @@ public:
};
struct QmlObjectProperty {
- enum Type { Unknown, Basic, Object, List };
+ enum Type { Unknown, Basic, Object, List, SignalProperty };
Type type;
QString name;
QVariant value;