QmlInspector: Fetch objects for location

Since the object tree is fetched lazily, we might have
objects whose debugIds are not known. In such cases,
objects can be fetched by passing the location info.

Change-Id: I2001460cc14401e011efef9be9194c9f7868d617
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
Aurindam Jana
2012-05-10 17:06:29 +02:00
parent 38905e523e
commit b9bc68c370
9 changed files with 121 additions and 14 deletions

View File

@@ -138,6 +138,19 @@ void BaseEngineDebugClient::decode(QDataStream &ds,
}
}
void BaseEngineDebugClient::decode(QDataStream &ds,
QVariantList &o,
bool simple)
{
int count;
ds >> count;
for (int i = 0; i < count; i++) {
ObjectReference obj;
decode(ds, obj, simple);
o << QVariant::fromValue(obj);
}
}
void BaseEngineDebugClient::decode(QDataStream &ds,
ContextReference &c)
{
@@ -202,6 +215,11 @@ void BaseEngineDebugClient::messageReceived(const QByteArray &data)
if (!ds.atEnd())
decode(ds, object, false);
emit result(queryId, QVariant::fromValue(object), type);
} else if (type == "FETCH_OBJECTS_FOR_LOCATION_R") {
QVariantList objects;
if (!ds.atEnd())
decode(ds, objects, false);
emit result(queryId, objects, type);
} else if (type == "EVAL_EXPRESSION_R") {;
QVariant exprResult;
ds >> exprResult;
@@ -413,4 +431,20 @@ quint32 BaseEngineDebugClient::setMethodBody(
return id;
}
quint32 BaseEngineDebugClient::queryObjectsForLocation(
const QString &fileName, int lineNumber, int columnNumber)
{
quint32 id = 0;
if (status() == Enabled) {
id = getId();
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
ds << QByteArray("FETCH_OBJECTS_FOR_LOCATION") << id <<
fileName << lineNumber << columnNumber << false <<
true;
sendMessage(message);
}
return id;
}
} // namespace QmlDebug