diff options
author | Aurindam Jana <aurindam.jana@nokia.com> | 2012-05-09 11:30:27 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-09 12:23:11 +0200 |
commit | c6c3673143ee1ceef686a014373bd99da1bddabd (patch) | |
tree | 149895f624257f3050cef2e45509805c0959dc54 /src | |
parent | e211cedddefb7c7d29987d63cc2dac6491ec7ce6 (diff) |
QQmlEngineDebugService: Query Expression
If the scope object is null or if there no QML context for
the scope object, try to use the root context of the engine.
Change-Id: I0068ea36f18a179b44791b81a2f6b8ec5423f615
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/debugger/qqmlenginedebugservice.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/qml/debugger/qqmlenginedebugservice.cpp b/src/qml/debugger/qqmlenginedebugservice.cpp index b095e8f9bb..21e9d67305 100644 --- a/src/qml/debugger/qqmlenginedebugservice.cpp +++ b/src/qml/debugger/qqmlenginedebugservice.cpp @@ -499,11 +499,20 @@ void QQmlEngineDebugService::processMessage(const QByteArray &message) QString expr; ds >> objectId >> expr; + int engineId = -1; + if (!ds.atEnd()) + ds >> engineId; QObject *object = QQmlDebugService::objectForId(objectId); QQmlContext *context = qmlContext(object); + if (!context) { + QQmlEngine *engine = qobject_cast<QQmlEngine *>( + QQmlDebugService::objectForId(engineId)); + if (engine && m_engines.contains(engine)) + context = engine->rootContext(); + } QVariant result; - if (object && context) { + if (context) { QQmlExpression exprObj(context, object, expr); bool undefined = false; QVariant value = exprObj.evaluate(&undefined); |