aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2018-10-16 15:25:43 +0200
committerUlf Hermann <ulf.hermann@qt.io>2018-10-24 05:57:46 +0000
commitad73e0b045d9f75ec420dc55b12671cc00cf40be (patch)
tree79e28634531b7a8585e38cd9d532474ea38034a6
parent2ebbf03e880467ecc95adfafe7c0404add8a3328 (diff)
QmlDebug: Add QQmlEngineDebugClient
We use it in 3 tests already, and we may want to use it in other applications, too. Task-number: QTBUG-66504 Change-Id: Id73b6ccf49a701fbbc79ee3fe1ac638a70c4c939 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--src/qmldebug/qmldebug.pro3
-rw-r--r--src/qmldebug/qqmlenginedebugclient.cpp (renamed from tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp)190
-rw-r--r--src/qmldebug/qqmlenginedebugclient_p.h168
-rw-r--r--src/qmldebug/qqmlenginedebugclient_p_p.h76
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro1
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp4
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro1
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp28
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro1
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp157
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebugclient.h233
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebugclient.pri3
12 files changed, 466 insertions, 399 deletions
diff --git a/src/qmldebug/qmldebug.pro b/src/qmldebug/qmldebug.pro
index 42b73e5711..c18d4c0c03 100644
--- a/src/qmldebug/qmldebug.pro
+++ b/src/qmldebug/qmldebug.pro
@@ -9,6 +9,7 @@ SOURCES += \
qqmldebugconnection.cpp \
qqmldebugmessageclient.cpp \
qqmlenginecontrolclient.cpp \
+ qqmlenginedebugclient.cpp \
qqmlpreviewclient.cpp \
qqmlprofilerclient.cpp \
qqmlprofilerevent.cpp \
@@ -22,6 +23,8 @@ HEADERS += \
qqmldebugclient_p_p.h \
qqmldebugconnection_p.h \
qqmldebugmessageclient_p.h \
+ qqmlenginedebugclient_p.h \
+ qqmlenginedebugclient_p_p.h \
qqmlenginecontrolclient_p.h \
qqmlenginecontrolclient_p_p.h \
qqmlpreviewclient_p.h \
diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp b/src/qmldebug/qqmlenginedebugclient.cpp
index 7e736ec400..ec45ec33bc 100644
--- a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
+++ b/src/qmldebug/qqmlenginedebugclient.cpp
@@ -26,22 +26,24 @@
**
****************************************************************************/
-#include "qqmlenginedebugclient.h"
+#include "qqmlenginedebugclient_p_p.h"
#include <private/qqmldebugconnection_p.h>
-struct QmlObjectData {
+QT_BEGIN_NAMESPACE
+
+struct QQmlObjectData {
QUrl url;
- int lineNumber;
- int columnNumber;
+ int lineNumber = -1;
+ int columnNumber = -1;
QString idString;
QString objectName;
QString objectType;
- int objectId;
- int contextId;
- int parentId;
+ int objectId = -1;
+ int contextId = -1;
+ int parentId = -1;
};
-QPacket &operator>>(QPacket &ds, QmlObjectData &data)
+QPacket &operator>>(QPacket &ds, QQmlObjectData &data)
{
ds >> data.url >> data.lineNumber >> data.columnNumber >> data.idString
>> data.objectName >> data.objectType >> data.objectId >> data.contextId
@@ -49,35 +51,38 @@ QPacket &operator>>(QPacket &ds, QmlObjectData &data)
return ds;
}
-struct QmlObjectProperty {
+struct QQmlObjectProperty {
enum Type { Unknown, Basic, Object, List, SignalProperty };
- Type type;
+ Type type = Unknown;
QString name;
QVariant value;
QString valueTypeName;
QString binding;
- bool hasNotifySignal;
+ bool hasNotifySignal = false;
};
-QPacket &operator>>(QPacket &ds, QmlObjectProperty &data)
+QPacket &operator>>(QPacket &ds, QQmlObjectProperty &data)
{
int type;
ds >> type >> data.name >> data.value >> data.valueTypeName
>> data.binding >> data.hasNotifySignal;
- data.type = (QmlObjectProperty::Type)type;
+ data.type = (QQmlObjectProperty::Type)type;
return ds;
}
-QQmlEngineDebugClient::QQmlEngineDebugClient(
- QQmlDebugConnection *connection)
- : QQmlDebugClient(QLatin1String("QmlDebugger"), connection),
- m_nextId(0),
- m_valid(false)
+QQmlEngineDebugClient::QQmlEngineDebugClient(QQmlDebugConnection *connection) :
+ QQmlDebugClient(*new QQmlEngineDebugClientPrivate(connection))
+{
+}
+
+QQmlEngineDebugClientPrivate::QQmlEngineDebugClientPrivate(QQmlDebugConnection *connection) :
+ QQmlDebugClientPrivate (QLatin1String("QmlDebugger"), connection)
{
}
+
quint32 QQmlEngineDebugClient::addWatch(
- const QmlDebugPropertyReference &property, bool *success)
+ const QQmlEngineDebugPropertyReference &property, bool *success)
{
quint32 id = -1;
*success = false;
@@ -93,7 +98,7 @@ quint32 QQmlEngineDebugClient::addWatch(
}
quint32 QQmlEngineDebugClient::addWatch(
- const QmlDebugContextReference &, const QString &, bool *success)
+ const QQmlEngineDebugContextReference &, const QString &, bool *success)
{
*success = false;
qWarning("QQmlEngineDebugClient::addWatch(): Not implemented");
@@ -101,7 +106,7 @@ quint32 QQmlEngineDebugClient::addWatch(
}
quint32 QQmlEngineDebugClient::addWatch(
- const QmlDebugObjectReference &object, const QString &expr,
+ const QQmlEngineDebugObjectReference &object, const QString &expr,
bool *success)
{
quint32 id = -1;
@@ -117,7 +122,7 @@ quint32 QQmlEngineDebugClient::addWatch(
}
quint32 QQmlEngineDebugClient::addWatch(
- const QmlDebugObjectReference &object, bool *success)
+ const QQmlEngineDebugObjectReference &object, bool *success)
{
quint32 id = -1;
*success = false;
@@ -132,7 +137,7 @@ quint32 QQmlEngineDebugClient::addWatch(
}
quint32 QQmlEngineDebugClient::addWatch(
- const QmlDebugFileReference &, bool *success)
+ const QQmlEngineDebugFileReference &, bool *success)
{
*success = false;
qWarning("QQmlEngineDebugClient::addWatch(): Not implemented");
@@ -152,7 +157,8 @@ void QQmlEngineDebugClient::removeWatch(quint32 id, bool *success)
quint32 QQmlEngineDebugClient::queryAvailableEngines(bool *success)
{
- m_engines.clear();
+ Q_D(QQmlEngineDebugClient);
+ d->engines.clear();
quint32 id = -1;
*success = false;
if (state() == QQmlDebugClient::Enabled) {
@@ -166,9 +172,10 @@ quint32 QQmlEngineDebugClient::queryAvailableEngines(bool *success)
}
quint32 QQmlEngineDebugClient::queryRootContexts(
- const QmlDebugEngineReference &engine, bool *success)
+ const QQmlEngineDebugEngineReference &engine, bool *success)
{
- m_rootContext = QmlDebugContextReference();
+ Q_D(QQmlEngineDebugClient);
+ d->rootContext = QQmlEngineDebugContextReference();
quint32 id = -1;
*success = false;
if (state() == QQmlDebugClient::Enabled && engine.debugId != -1) {
@@ -182,9 +189,10 @@ quint32 QQmlEngineDebugClient::queryRootContexts(
}
quint32 QQmlEngineDebugClient::queryObject(
- const QmlDebugObjectReference &object, bool *success)
+ const QQmlEngineDebugObjectReference &object, bool *success)
{
- m_object = QmlDebugObjectReference();
+ Q_D(QQmlEngineDebugClient);
+ d->object = QQmlEngineDebugObjectReference();
quint32 id = -1;
*success = false;
if (state() == QQmlDebugClient::Enabled && object.debugId != -1) {
@@ -200,7 +208,8 @@ quint32 QQmlEngineDebugClient::queryObject(
quint32 QQmlEngineDebugClient::queryObjectsForLocation(
const QString &file, int lineNumber, int columnNumber, bool *success)
{
- m_objects.clear();
+ Q_D(QQmlEngineDebugClient);
+ d->objects.clear();
quint32 id = -1;
*success = false;
if (state() == QQmlDebugClient::Enabled) {
@@ -215,9 +224,10 @@ quint32 QQmlEngineDebugClient::queryObjectsForLocation(
}
quint32 QQmlEngineDebugClient::queryObjectRecursive(
- const QmlDebugObjectReference &object, bool *success)
+ const QQmlEngineDebugObjectReference &object, bool *success)
{
- m_object = QmlDebugObjectReference();
+ Q_D(QQmlEngineDebugClient);
+ d->object = QQmlEngineDebugObjectReference();
quint32 id = -1;
*success = false;
if (state() == QQmlDebugClient::Enabled && object.debugId != -1) {
@@ -233,7 +243,8 @@ quint32 QQmlEngineDebugClient::queryObjectRecursive(
quint32 QQmlEngineDebugClient::queryObjectsForLocationRecursive(const QString &file,
int lineNumber, int columnNumber, bool *success)
{
- m_objects.clear();
+ Q_D(QQmlEngineDebugClient);
+ d->objects.clear();
quint32 id = -1;
*success = false;
if (state() == QQmlDebugClient::Enabled) {
@@ -250,7 +261,8 @@ quint32 QQmlEngineDebugClient::queryObjectsForLocationRecursive(const QString &f
quint32 QQmlEngineDebugClient::queryExpressionResult(
int objectDebugId, const QString &expr, bool *success)
{
- m_exprResult = QVariant();
+ Q_D(QQmlEngineDebugClient);
+ d->exprResult = QVariant();
quint32 id = -1;
*success = false;
if (state() == QQmlDebugClient::Enabled) {
@@ -267,7 +279,8 @@ quint32 QQmlEngineDebugClient::queryExpressionResult(
quint32 QQmlEngineDebugClient::queryExpressionResultBC(
int objectDebugId, const QString &expr, bool *success)
{
- m_exprResult = QVariant();
+ Q_D(QQmlEngineDebugClient);
+ d->exprResult = QVariant();
quint32 id = -1;
*success = false;
if (state() == QQmlDebugClient::Enabled) {
@@ -285,7 +298,7 @@ quint32 QQmlEngineDebugClient::setBindingForObject(
const QString &propertyName,
const QVariant &bindingExpression,
bool isLiteralValue,
- QString source, int line,
+ const QString &source, int line,
bool *success)
{
quint32 id = -1;
@@ -336,10 +349,10 @@ quint32 QQmlEngineDebugClient::setMethodBody(
}
void QQmlEngineDebugClient::decode(QPacket &ds,
- QmlDebugObjectReference &o,
+ QQmlEngineDebugObjectReference &o,
bool simple)
{
- QmlObjectData data;
+ QQmlObjectData data;
ds >> data;
o.debugId = data.objectId;
o.className = data.objectType;
@@ -358,7 +371,7 @@ void QQmlEngineDebugClient::decode(QPacket &ds,
ds >> childCount >> recur;
for (int ii = 0; ii < childCount; ++ii) {
- o.children.append(QmlDebugObjectReference());
+ o.children.append(QQmlEngineDebugObjectReference());
decode(ds, o.children.last(), !recur);
}
@@ -366,31 +379,31 @@ void QQmlEngineDebugClient::decode(QPacket &ds,
ds >> propCount;
for (int ii = 0; ii < propCount; ++ii) {
- QmlObjectProperty data;
+ QQmlObjectProperty data;
ds >> data;
- QmlDebugPropertyReference prop;
+ QQmlEngineDebugPropertyReference prop;
prop.objectDebugId = o.debugId;
prop.name = data.name;
prop.binding = data.binding;
prop.hasNotifySignal = data.hasNotifySignal;
prop.valueTypeName = data.valueTypeName;
switch (data.type) {
- case QmlObjectProperty::Basic:
- case QmlObjectProperty::List:
- case QmlObjectProperty::SignalProperty:
+ case QQmlObjectProperty::Basic:
+ case QQmlObjectProperty::List:
+ case QQmlObjectProperty::SignalProperty:
{
prop.value = data.value;
break;
}
- case QmlObjectProperty::Object:
+ case QQmlObjectProperty::Object:
{
- QmlDebugObjectReference obj;
+ QQmlEngineDebugObjectReference obj;
obj.name = data.value.toString();
obj.className = prop.valueTypeName;
prop.value = qVariantFromValue(obj);
break;
}
- case QmlObjectProperty::Unknown:
+ case QQmlObjectProperty::Unknown:
break;
}
o.properties << prop;
@@ -398,20 +411,56 @@ void QQmlEngineDebugClient::decode(QPacket &ds,
}
void QQmlEngineDebugClient::decode(QPacket &ds,
- QList<QmlDebugObjectReference> &o,
+ QList<QQmlEngineDebugObjectReference> &o,
bool simple)
{
int count;
ds >> count;
for (int i = 0; i < count; i++) {
- QmlDebugObjectReference obj;
+ QQmlEngineDebugObjectReference obj;
decode(ds, obj, simple);
o << obj;
}
}
+QList<QQmlEngineDebugEngineReference> QQmlEngineDebugClient::engines() const
+{
+ Q_D(const QQmlEngineDebugClient);
+ return d->engines;
+}
+
+QQmlEngineDebugContextReference QQmlEngineDebugClient::rootContext() const
+{
+ Q_D(const QQmlEngineDebugClient);
+ return d->rootContext;
+}
+
+QQmlEngineDebugObjectReference QQmlEngineDebugClient::object() const
+{
+ Q_D(const QQmlEngineDebugClient);
+ return d->object;
+}
+
+QList<QQmlEngineDebugObjectReference> QQmlEngineDebugClient::objects() const
+{
+ Q_D(const QQmlEngineDebugClient);
+ return d->objects;
+}
+
+QVariant QQmlEngineDebugClient::resultExpr() const
+{
+ Q_D(const QQmlEngineDebugClient);
+ return d->exprResult;
+}
+
+bool QQmlEngineDebugClient::valid() const
+{
+ Q_D(const QQmlEngineDebugClient);
+ return d->valid;
+}
+
void QQmlEngineDebugClient::decode(QPacket &ds,
- QmlDebugContextReference &c)
+ QQmlEngineDebugContextReference &c)
{
ds >> c.name >> c.debugId;
@@ -419,7 +468,7 @@ void QQmlEngineDebugClient::decode(QPacket &ds,
ds >> contextCount;
for (int ii = 0; ii < contextCount; ++ii) {
- c.contexts.append(QmlDebugContextReference());
+ c.contexts.append(QQmlEngineDebugContextReference());
decode(ds, c.contexts.last());
}
@@ -427,7 +476,7 @@ void QQmlEngineDebugClient::decode(QPacket &ds,
ds >> objectCount;
for (int ii = 0; ii < objectCount; ++ii) {
- QmlDebugObjectReference obj;
+ QQmlEngineDebugObjectReference obj;
decode(ds, obj, true);
obj.contextDebugId = c.debugId;
@@ -437,7 +486,8 @@ void QQmlEngineDebugClient::decode(QPacket &ds,
void QQmlEngineDebugClient::messageReceived(const QByteArray &data)
{
- m_valid = false;
+ Q_D(QQmlEngineDebugClient);
+ d->valid = false;
QPacket ds(connection()->currentDataStreamVersion(), data);
int queryId;
@@ -450,36 +500,36 @@ void QQmlEngineDebugClient::messageReceived(const QByteArray &data)
int count;
ds >> count;
- m_engines.clear();
+ d->engines.clear();
for (int ii = 0; ii < count; ++ii) {
- QmlDebugEngineReference eng;
+ QQmlEngineDebugEngineReference eng;
ds >> eng.name;
ds >> eng.debugId;
- m_engines << eng;
+ d->engines << eng;
}
} else if (type == "LIST_OBJECTS_R") {
if (!ds.atEnd())
- decode(ds, m_rootContext);
+ decode(ds, d->rootContext);
} else if (type == "FETCH_OBJECT_R") {
if (!ds.atEnd())
- decode(ds, m_object, false);
+ decode(ds, d->object, false);
} else if (type == "FETCH_OBJECTS_FOR_LOCATION_R") {
if (!ds.atEnd())
- decode(ds, m_objects, false);
+ decode(ds, d->objects, false);
} else if (type == "EVAL_EXPRESSION_R") {;
- ds >> m_exprResult;
+ ds >> d->exprResult;
} else if (type == "WATCH_PROPERTY_R") {
- ds >> m_valid;
+ ds >> d->valid;
} else if (type == "WATCH_OBJECT_R") {
- ds >> m_valid;
+ ds >> d->valid;
} else if (type == "WATCH_EXPR_OBJECT_R") {
- ds >> m_valid;
+ ds >> d->valid;
} else if (type == "UPDATE_WATCH") {
int debugId;
@@ -495,14 +545,22 @@ void QQmlEngineDebugClient::messageReceived(const QByteArray &data)
emit newObject(objectId);
return;
} else if (type == "SET_BINDING_R") {
- ds >> m_valid;
+ ds >> d->valid;
} else if (type == "RESET_BINDING_R") {
- ds >> m_valid;
+ ds >> d->valid;
} else if (type == "SET_METHOD_BODY_R") {
- ds >> m_valid;
+ ds >> d->valid;
} else if (type == "NO_WATCH_R") {
- ds >> m_valid;
+ ds >> d->valid;
}
emit result();
}
+
+quint32 QQmlEngineDebugClient::getId()
+{
+ Q_D(QQmlEngineDebugClient);
+ return d->nextId++;
+}
+
+QT_END_NAMESPACE
diff --git a/src/qmldebug/qqmlenginedebugclient_p.h b/src/qmldebug/qqmlenginedebugclient_p.h
new file mode 100644
index 0000000000..4a9cc3a020
--- /dev/null
+++ b/src/qmldebug/qqmlenginedebugclient_p.h
@@ -0,0 +1,168 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQMLENGINEDEBUGCLIENT_H
+#define QQMLENGINEDEBUGCLIENT_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qqmldebugclient_p.h>
+#include <private/qpacket_p.h>
+
+#include <QtCore/qurl.h>
+#include <QtCore/qvariant.h>
+
+QT_BEGIN_NAMESPACE
+
+struct QQmlEngineDebugPropertyReference
+{
+ int objectDebugId = -1;
+ QString name;
+ QVariant value;
+ QString valueTypeName;
+ QString binding;
+ bool hasNotifySignal = false;
+};
+
+struct QQmlEngineDebugFileReference
+{
+ QUrl url;
+ int lineNumber = -1;
+ int columnNumber = -1;
+};
+
+struct QQmlEngineDebugObjectReference
+{
+ int debugId = -1;
+ QString className;
+ QString idString;
+ QString name;
+ QQmlEngineDebugFileReference source;
+ int contextDebugId = -1;
+ QList<QQmlEngineDebugPropertyReference> properties;
+ QList<QQmlEngineDebugObjectReference> children;
+};
+
+struct QQmlEngineDebugContextReference
+{
+ int debugId = -1;
+ QString name;
+ QList<QQmlEngineDebugObjectReference> objects;
+ QList<QQmlEngineDebugContextReference> contexts;
+};
+
+struct QQmlEngineDebugEngineReference
+{
+ int debugId = -1;
+ QString name;
+};
+
+class QQmlEngineDebugClientPrivate;
+class QQmlEngineDebugClient : public QQmlDebugClient
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QQmlEngineDebugClient)
+
+public:
+ explicit QQmlEngineDebugClient(QQmlDebugConnection *conn);
+
+ quint32 addWatch(const QQmlEngineDebugPropertyReference &,
+ bool *success);
+ quint32 addWatch(const QQmlEngineDebugContextReference &, const QString &,
+ bool *success);
+ quint32 addWatch(const QQmlEngineDebugObjectReference &, const QString &,
+ bool *success);
+ quint32 addWatch(const QQmlEngineDebugObjectReference &,
+ bool *success);
+ quint32 addWatch(const QQmlEngineDebugFileReference &,
+ bool *success);
+
+ void removeWatch(quint32 watch, bool *success);
+
+ quint32 queryAvailableEngines(bool *success);
+ quint32 queryRootContexts(const QQmlEngineDebugEngineReference &,
+ bool *success);
+ quint32 queryObject(const QQmlEngineDebugObjectReference &,
+ bool *success);
+ quint32 queryObjectsForLocation(const QString &file,
+ int lineNumber, int columnNumber, bool *success);
+ quint32 queryObjectRecursive(const QQmlEngineDebugObjectReference &,
+ bool *success);
+ quint32 queryObjectsForLocationRecursive(const QString &file,
+ int lineNumber, int columnNumber, bool *success);
+ quint32 queryExpressionResult(int objectDebugId,
+ const QString &expr,
+ bool *success);
+ quint32 queryExpressionResultBC(int objectDebugId,
+ const QString &expr,
+ bool *success);
+ quint32 setBindingForObject(int objectDebugId, const QString &propertyName,
+ const QVariant &bindingExpression,
+ bool isLiteralValue,
+ const QString &source, int line, bool *success);
+ quint32 resetBindingForObject(int objectDebugId,
+ const QString &propertyName, bool *success);
+ quint32 setMethodBody(int objectDebugId, const QString &methodName,
+ const QString &methodBody, bool *success);
+
+ quint32 getId();
+
+ void decode(QPacket &ds, QQmlEngineDebugContextReference &);
+ void decode(QPacket &ds, QQmlEngineDebugObjectReference &, bool simple);
+ void decode(QPacket &ds, QList<QQmlEngineDebugObjectReference> &o, bool simple);
+
+ QList<QQmlEngineDebugEngineReference> engines() const;
+ QQmlEngineDebugContextReference rootContext() const;
+ QQmlEngineDebugObjectReference object() const;
+ QList<QQmlEngineDebugObjectReference> objects() const;
+ QVariant resultExpr() const;
+ bool valid() const;
+
+signals:
+ void newObject(int objectId);
+ void valueChanged(QByteArray,QVariant);
+ void result();
+
+protected:
+ void messageReceived(const QByteArray &) override;
+};
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QQmlEngineDebugObjectReference)
+
+#endif // QQMLENGINEDEBUGCLIENT_H
diff --git a/src/qmldebug/qqmlenginedebugclient_p_p.h b/src/qmldebug/qqmlenginedebugclient_p_p.h
new file mode 100644
index 0000000000..7c992ad3ab
--- /dev/null
+++ b/src/qmldebug/qqmlenginedebugclient_p_p.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQMLENGINEDEBUGCLIENT_P_P_H
+#define QQMLENGINEDEBUGCLIENT_P_P_H
+
+#include "qqmlenginedebugclient_p.h"
+#include "qqmldebugclient_p_p.h"
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+class QQmlEngineDebugClientPrivate : public QQmlDebugClientPrivate
+{
+ Q_DECLARE_PUBLIC(QQmlEngineDebugClient)
+public:
+ QQmlEngineDebugClientPrivate(QQmlDebugConnection *connection);
+
+ quint32 nextId = 0;
+ bool valid = false;
+ QList<QQmlEngineDebugEngineReference> engines;
+ QQmlEngineDebugContextReference rootContext;
+ QQmlEngineDebugObjectReference object;
+ QList<QQmlEngineDebugObjectReference> objects;
+ QVariant exprResult;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQMLENGINEDEBUGCLIENT_P_P_H
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
index 2a32fa445b..acd5546a02 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
@@ -7,7 +7,6 @@ SOURCES += tst_qqmldebugjs.cpp
INCLUDEPATH += ../shared
include(../shared/debugutil.pri)
-include(../shared/qqmlenginedebugclient.pri)
TESTDATA = data/*
diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
index 79a1e56a41..f8fa6e6716 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
+++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
@@ -28,9 +28,9 @@
#include "debugutil_p.h"
#include "qqmldebugprocess_p.h"
-#include "../shared/qqmlenginedebugclient.h"
#include "../../../shared/util.h"
+#include <private/qqmlenginedebugclient_p.h>
#include <private/qv4debugclient_p.h>
#include <private/qqmldebugconnection_p.h>
#include <private/qpacket_p.h>
@@ -836,7 +836,7 @@ void tst_QQmlDebugJS::evaluateInContext()
QVERIFY(QQmlDebugTest::waitForSignal(engineClient.data(), SIGNAL(result())));
QVERIFY(engineClient->engines().count());
- engineClient->queryRootContexts(engineClient->engines()[0].debugId, &success);
+ engineClient->queryRootContexts(engineClient->engines()[0], &success);
QVERIFY(success);
QVERIFY(QQmlDebugTest::waitForSignal(engineClient.data(), SIGNAL(result())));
diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro
index 54244c6d16..f69199f7d1 100644
--- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro
+++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro
@@ -7,7 +7,6 @@ osx:CONFIG -= app_bundle
SOURCES += tst_qqmlenginedebuginspectorintegration.cpp
include(../shared/qqmlinspectorclient.pri)
-include(../shared/qqmlenginedebugclient.pri)
include(../shared/debugutil.pri)
TESTDATA = data/*
diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
index 249416a3b9..5e12a31163 100644
--- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
@@ -27,11 +27,11 @@
****************************************************************************/
#include "qqmlinspectorclient.h"
-#include "qqmlenginedebugclient.h"
#include "../shared/debugutil_p.h"
#include "../../../shared/util.h"
#include <private/qqmldebugconnection_p.h>
+#include <private/qqmlenginedebugclient_p.h>
#include <QtTest/qtest.h>
#include <QtTest/qsignalspy.h>
@@ -49,7 +49,7 @@ private:
ConnectResult init(bool restrictServices);
QList<QQmlDebugClient *> createClients() override;
- QmlDebugObjectReference findRootObject();
+ QQmlEngineDebugObjectReference findRootObject();
QPointer<QQmlInspectorClient> m_inspectorClient;
QPointer<QQmlEngineDebugClient> m_engineDebugClient;
@@ -65,23 +65,23 @@ private slots:
void destroyObject();
};
-QmlDebugObjectReference tst_QQmlEngineDebugInspectorIntegration::findRootObject()
+QQmlEngineDebugObjectReference tst_QQmlEngineDebugInspectorIntegration::findRootObject()
{
bool success = false;
m_engineDebugClient->queryAvailableEngines(&success);
if (!QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result())))
- return QmlDebugObjectReference();
+ return QQmlEngineDebugObjectReference();
- m_engineDebugClient->queryRootContexts(m_engineDebugClient->engines()[0].debugId, &success);
+ m_engineDebugClient->queryRootContexts(m_engineDebugClient->engines()[0], &success);
if (!QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result())))
- return QmlDebugObjectReference();
+ return QQmlEngineDebugObjectReference();
int count = m_engineDebugClient->rootContext().contexts.count();
m_engineDebugClient->queryObject(
m_engineDebugClient->rootContext().contexts[count - 1].objects[0], &success);
if (!QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result())))
- return QmlDebugObjectReference();
+ return QQmlEngineDebugObjectReference();
return m_engineDebugClient->object();
}
@@ -121,7 +121,7 @@ void tst_QQmlEngineDebugInspectorIntegration::objectLocationLookup()
QCOMPARE(init(true), ConnectSuccess);
bool success = false;
- QmlDebugObjectReference rootObject = findRootObject();
+ QQmlEngineDebugObjectReference rootObject = findRootObject();
QVERIFY(rootObject.debugId != -1);
const QString fileName = QFileInfo(rootObject.source.url.toString()).fileName();
int lineNumber = rootObject.source.lineNumber;
@@ -131,7 +131,7 @@ void tst_QQmlEngineDebugInspectorIntegration::objectLocationLookup()
QVERIFY(success);
QVERIFY(QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result())));
- foreach (QmlDebugObjectReference child, rootObject.children) {
+ foreach (QQmlEngineDebugObjectReference child, rootObject.children) {
success = false;
lineNumber = child.source.lineNumber;
columnNumber = child.source.columnNumber;
@@ -146,10 +146,10 @@ void tst_QQmlEngineDebugInspectorIntegration::select()
{
QCOMPARE(init(true), ConnectSuccess);
- QmlDebugObjectReference rootObject = findRootObject();
+ QQmlEngineDebugObjectReference rootObject = findRootObject();
QList<int> childIds;
int requestId = 0;
- foreach (const QmlDebugObjectReference &child, rootObject.children) {
+ foreach (const QQmlEngineDebugObjectReference &child, rootObject.children) {
requestId = m_inspectorClient->select(QList<int>() << child.debugId);
QTRY_COMPARE(m_recipient->lastResponseId, requestId);
QVERIFY(m_recipient->lastResult);
@@ -171,7 +171,7 @@ void tst_QQmlEngineDebugInspectorIntegration::createObject()
" color: \"blue\"\n"
"}");
- QmlDebugObjectReference rootObject = findRootObject();
+ QQmlEngineDebugObjectReference rootObject = findRootObject();
QVERIFY(rootObject.debugId != -1);
QCOMPARE(rootObject.children.length(), 2);
@@ -192,7 +192,7 @@ void tst_QQmlEngineDebugInspectorIntegration::moveObject()
QCOMPARE(init(true), ConnectSuccess);
QCOMPARE(m_inspectorClient->state(), QQmlDebugClient::Enabled);
- QmlDebugObjectReference rootObject = findRootObject();
+ QQmlEngineDebugObjectReference rootObject = findRootObject();
QVERIFY(rootObject.debugId != -1);
QCOMPARE(rootObject.children.length(), 2);
@@ -217,7 +217,7 @@ void tst_QQmlEngineDebugInspectorIntegration::destroyObject()
QCOMPARE(init(true), ConnectSuccess);
QCOMPARE(m_inspectorClient->state(), QQmlDebugClient::Enabled);
- QmlDebugObjectReference rootObject = findRootObject();
+ QQmlEngineDebugObjectReference rootObject = findRootObject();
QVERIFY(rootObject.debugId != -1);
QCOMPARE(rootObject.children.length(), 2);
diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro b/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro
index ed4224446e..5ff65ba276 100644
--- a/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro
@@ -5,7 +5,6 @@ osx:CONFIG -= app_bundle
SOURCES += \
tst_qqmlenginedebugservice.cpp
-include(../shared/qqmlenginedebugclient.pri)
include(../shared/debugutil.pri)
DEFINES += QT_QML_DEBUG_NO_WARNING
diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
index c613d88b2b..99c90c142f 100644
--- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
@@ -26,7 +26,6 @@
**
****************************************************************************/
-#include "qqmlenginedebugclient.h"
#include "debugutil_p.h"
#include "../../../shared/util.h"
@@ -36,6 +35,7 @@
#include <private/qqmlmetatype_p.h>
#include <private/qqmlproperty_p.h>
#include <private/qqmldebugconnection_p.h>
+#include <private/qqmlenginedebugclient_p.h>
#include <QtTest/qtest.h>
#include <QtTest/qsignalspy.h>
@@ -60,7 +60,7 @@
#define QVERIFYOBJECT(statement) \
do {\
if (!QTest::qVerify((statement), #statement, "", __FILE__, __LINE__)) {\
- return QmlDebugObjectReference();\
+ return QQmlEngineDebugObjectReference();\
}\
} while (0)
@@ -126,14 +126,14 @@ public:
tst_QQmlEngineDebugService() : m_conn(nullptr), m_dbg(nullptr), m_engine(nullptr), m_rootItem(nullptr) {}
private:
- QmlDebugObjectReference findRootObject(int context = 0,
+ QQmlEngineDebugObjectReference findRootObject(int context = 0,
bool recursive = false);
- QmlDebugPropertyReference findProperty(
- const QList<QmlDebugPropertyReference> &props,
+ QQmlEngineDebugPropertyReference findProperty(
+ const QList<QQmlEngineDebugPropertyReference> &props,
const QString &name) const;
void recursiveObjectTest(QObject *o,
- const QmlDebugObjectReference &oref,
+ const QQmlEngineDebugObjectReference &oref,
bool recursive) const;
void getContexts();
@@ -182,7 +182,7 @@ private slots:
void createObjectOnDestruction();
};
-QmlDebugObjectReference tst_QQmlEngineDebugService::findRootObject(
+QQmlEngineDebugObjectReference tst_QQmlEngineDebugService::findRootObject(
int context, bool recursive)
{
bool success = false;
@@ -191,7 +191,7 @@ QmlDebugObjectReference tst_QQmlEngineDebugService::findRootObject(
QVERIFYOBJECT(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
QVERIFYOBJECT(m_dbg->engines().count());
- m_dbg->queryRootContexts(m_dbg->engines()[0].debugId, &success);
+ m_dbg->queryRootContexts(m_dbg->engines()[0], &success);
QVERIFYOBJECT(success);
QVERIFYOBJECT(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
@@ -207,18 +207,18 @@ QmlDebugObjectReference tst_QQmlEngineDebugService::findRootObject(
return m_dbg->object();
}
-QmlDebugPropertyReference tst_QQmlEngineDebugService::findProperty(
- const QList<QmlDebugPropertyReference> &props, const QString &name) const
+QQmlEngineDebugPropertyReference tst_QQmlEngineDebugService::findProperty(
+ const QList<QQmlEngineDebugPropertyReference> &props, const QString &name) const
{
- foreach (const QmlDebugPropertyReference &p, props) {
+ foreach (const QQmlEngineDebugPropertyReference &p, props) {
if (p.name == name)
return p;
}
- return QmlDebugPropertyReference();
+ return QQmlEngineDebugPropertyReference();
}
void tst_QQmlEngineDebugService::recursiveObjectTest(
- QObject *o, const QmlDebugObjectReference &oref, bool recursive) const
+ QObject *o, const QQmlEngineDebugObjectReference &oref, bool recursive) const
{
const QMetaObject *meta = o->metaObject();
@@ -236,8 +236,8 @@ void tst_QQmlEngineDebugService::recursiveObjectTest(
int debugId = QQmlDebugService::idForObject(child);
QVERIFY(debugId >= 0);
- QmlDebugObjectReference cref;
- foreach (const QmlDebugObjectReference &ref, oref.children) {
+ QQmlEngineDebugObjectReference cref;
+ foreach (const QQmlEngineDebugObjectReference &ref, oref.children) {
QVERIFY(!ref.className.isEmpty());
if (ref.debugId == debugId) {
cref = ref;
@@ -250,7 +250,7 @@ void tst_QQmlEngineDebugService::recursiveObjectTest(
recursiveObjectTest(child, cref, true);
}
- foreach (const QmlDebugPropertyReference &p, oref.properties) {
+ foreach (const QQmlEngineDebugPropertyReference &p, oref.properties) {
QCOMPARE(p.objectDebugId, QQmlDebugService::idForObject(o));
// signal properties are fake - they are generated from QQmlAbstractBoundSignal children
@@ -269,7 +269,8 @@ void tst_QQmlEngineDebugService::recursiveObjectTest(
QCOMPARE(p.name, QString::fromUtf8(pmeta.name()));
if (pmeta.userType() == QMetaType::QObjectStar) {
- const QmlDebugObjectReference ref = qvariant_cast<QmlDebugObjectReference>(p.value);
+ const QQmlEngineDebugObjectReference ref
+ = qvariant_cast<QQmlEngineDebugObjectReference>(p.value);
QObject *pobj = qvariant_cast<QObject *>(pmeta.read(o));
if (pobj) {
if (pobj->objectName().isEmpty())
@@ -312,9 +313,9 @@ void tst_QQmlEngineDebugService::getContexts()
QVERIFY(success);
QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
- QList<QmlDebugEngineReference> engines = m_dbg->engines();
+ QList<QQmlEngineDebugEngineReference> engines = m_dbg->engines();
QCOMPARE(engines.count(), 1);
- m_dbg->queryRootContexts(engines.first().debugId, &success);
+ m_dbg->queryRootContexts(engines.first(), &success);
QVERIFY(success);
QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
@@ -441,7 +442,7 @@ void tst_QQmlEngineDebugService::cleanupTestCase()
void tst_QQmlEngineDebugService::setMethodBody()
{
bool success;
- QmlDebugObjectReference obj = findRootObject(2);
+ QQmlEngineDebugObjectReference obj = findRootObject(2);
QVERIFY(!obj.className.isEmpty());
QObject *root = m_components.at(2);
@@ -483,9 +484,9 @@ void tst_QQmlEngineDebugService::setMethodBody()
void tst_QQmlEngineDebugService::watch_property()
{
- QmlDebugObjectReference obj = findRootObject();
+ QQmlEngineDebugObjectReference obj = findRootObject();
QVERIFY(!obj.className.isEmpty());
- QmlDebugPropertyReference prop = findProperty(obj.properties, "width");
+ QQmlEngineDebugPropertyReference prop = findProperty(obj.properties, "width");
bool success;
@@ -494,7 +495,7 @@ void tst_QQmlEngineDebugService::watch_property()
QVERIFY(!success);
delete unconnected;
- m_dbg->addWatch(QmlDebugPropertyReference(), &success);
+ m_dbg->addWatch(QQmlEngineDebugPropertyReference(), &success);
QVERIFY(success);
QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
QCOMPARE(m_dbg->valid(), false);
@@ -528,7 +529,7 @@ void tst_QQmlEngineDebugService::watch_property()
void tst_QQmlEngineDebugService::watch_object()
{
- QmlDebugObjectReference obj = findRootObject();
+ QQmlEngineDebugObjectReference obj = findRootObject();
QVERIFY(!obj.className.isEmpty());
bool success;
@@ -538,7 +539,7 @@ void tst_QQmlEngineDebugService::watch_object()
QVERIFY(!success);
delete unconnected;
- m_dbg->addWatch(QmlDebugObjectReference(), &success);
+ m_dbg->addWatch(QQmlEngineDebugObjectReference(), &success);
QVERIFY(success);
QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
QCOMPARE(m_dbg->valid(), false);
@@ -594,7 +595,7 @@ void tst_QQmlEngineDebugService::watch_expression()
int origWidth = m_rootItem->property("width").toInt();
- QmlDebugObjectReference obj = findRootObject();
+ QQmlEngineDebugObjectReference obj = findRootObject();
QVERIFY(!obj.className.isEmpty());
bool success;
@@ -604,7 +605,7 @@ void tst_QQmlEngineDebugService::watch_expression()
QVERIFY(!success);
delete unconnected;
- m_dbg->addWatch(QmlDebugObjectReference(), expr, &success);
+ m_dbg->addWatch(QQmlEngineDebugObjectReference(), expr, &success);
QVERIFY(success);
QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
QCOMPARE(m_dbg->valid(), false);
@@ -654,7 +655,7 @@ void tst_QQmlEngineDebugService::watch_expression_data()
void tst_QQmlEngineDebugService::watch_context()
{
- QmlDebugContextReference c;
+ QQmlEngineDebugContextReference c;
QTest::ignoreMessage(QtWarningMsg, "QQmlEngineDebugClient::addWatch(): Not implemented");
bool success;
m_dbg->addWatch(c, QString(), &success);
@@ -663,7 +664,7 @@ void tst_QQmlEngineDebugService::watch_context()
void tst_QQmlEngineDebugService::watch_file()
{
- QmlDebugFileReference f;
+ QQmlEngineDebugFileReference f;
QTest::ignoreMessage(QtWarningMsg, "QQmlEngineDebugClient::addWatch(): Not implemented");
bool success;
m_dbg->addWatch(f, &success);
@@ -684,10 +685,10 @@ void tst_QQmlEngineDebugService::queryAvailableEngines()
QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
// TODO test multiple engines
- QList<QmlDebugEngineReference> engines = m_dbg->engines();
+ QList<QQmlEngineDebugEngineReference> engines = m_dbg->engines();
QCOMPARE(engines.count(), 1);
- foreach (const QmlDebugEngineReference &e, engines) {
+ foreach (const QQmlEngineDebugEngineReference &e, engines) {
QCOMPARE(e.debugId, QQmlDebugService::idForObject(m_engine));
QCOMPARE(e.name, m_engine->objectName());
}
@@ -700,19 +701,19 @@ void tst_QQmlEngineDebugService::queryRootContexts()
QVERIFY(success);
QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
QVERIFY(m_dbg->engines().count());
- int engineId = m_dbg->engines()[0].debugId;
+ const QQmlEngineDebugEngineReference engine = m_dbg->engines()[0];
QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(nullptr);
- unconnected->queryRootContexts(engineId, &success);
+ unconnected->queryRootContexts(engine, &success);
QVERIFY(!success);
delete unconnected;
- m_dbg->queryRootContexts(engineId, &success);
+ m_dbg->queryRootContexts(engine, &success);
QVERIFY(success);
QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
QQmlContext *actualContext = m_engine->rootContext();
- QmlDebugContextReference context = m_dbg->rootContext();
+ QQmlEngineDebugContextReference context = m_dbg->rootContext();
QCOMPARE(context.debugId, QQmlDebugService::idForObject(actualContext));
QCOMPARE(context.name, actualContext->objectName());
@@ -730,7 +731,7 @@ void tst_QQmlEngineDebugService::queryObject()
bool success;
- QmlDebugObjectReference rootObject = findRootObject();
+ QQmlEngineDebugObjectReference rootObject = findRootObject();
QVERIFY(!rootObject.className.isEmpty());
QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(nullptr);
@@ -742,11 +743,11 @@ void tst_QQmlEngineDebugService::queryObject()
QVERIFY(success);
QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
- QmlDebugObjectReference obj = m_dbg->object();
+ QQmlEngineDebugObjectReference obj = m_dbg->object();
QVERIFY(!obj.className.isEmpty());
// check source as defined in main()
- QmlDebugFileReference source = obj.source;
+ QQmlEngineDebugFileReference source = obj.source;
QCOMPARE(source.url, QUrl::fromLocalFile(""));
QCOMPARE(source.lineNumber, 3);
QCOMPARE(source.columnNumber, 1);
@@ -755,14 +756,14 @@ void tst_QQmlEngineDebugService::queryObject()
recursiveObjectTest(m_rootItem, obj, recursive);
if (recursive) {
- foreach (const QmlDebugObjectReference &child, obj.children) {
+ foreach (const QQmlEngineDebugObjectReference &child, obj.children) {
QVERIFY(!child.className.isEmpty());
QVERIFY(child.properties.count() > 0);
}
- QmlDebugObjectReference rect;
- QmlDebugObjectReference text;
- foreach (const QmlDebugObjectReference &child, obj.children) {
+ QQmlEngineDebugObjectReference rect;
+ QQmlEngineDebugObjectReference text;
+ foreach (const QQmlEngineDebugObjectReference &child, obj.children) {
QVERIFY(!child.className.isEmpty());
if (child.className == "Rectangle")
rect = child;
@@ -777,7 +778,7 @@ void tst_QQmlEngineDebugService::queryObject()
QCOMPARE(findProperty(text.properties, "color").value, qVariantFromValue(QColor("blue")));
} else {
- foreach (const QmlDebugObjectReference &child, obj.children) {
+ foreach (const QQmlEngineDebugObjectReference &child, obj.children) {
QVERIFY(!child.className.isEmpty());
QCOMPARE(child.properties.count(), 0);
}
@@ -798,7 +799,7 @@ void tst_QQmlEngineDebugService::queryObjectsForLocation()
bool success;
- QmlDebugObjectReference rootObject = findRootObject();
+ QQmlEngineDebugObjectReference rootObject = findRootObject();
QVERIFY(!rootObject.className.isEmpty());
const QString fileName = QFileInfo(rootObject.source.url.toString()).fileName();
@@ -821,11 +822,11 @@ void tst_QQmlEngineDebugService::queryObjectsForLocation()
QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
QCOMPARE(m_dbg->objects().count(), 1);
- QmlDebugObjectReference obj = m_dbg->objects().first();
+ QQmlEngineDebugObjectReference obj = m_dbg->objects().first();
QVERIFY(!obj.className.isEmpty());
// check source as defined in main()
- QmlDebugFileReference source = obj.source;
+ QQmlEngineDebugFileReference source = obj.source;
QCOMPARE(source.url, QUrl(fileName));
QCOMPARE(source.lineNumber, lineNumber);
QCOMPARE(source.columnNumber, columnNumber);
@@ -834,14 +835,14 @@ void tst_QQmlEngineDebugService::queryObjectsForLocation()
recursiveObjectTest(m_rootItem, obj, recursive);
if (recursive) {
- foreach (const QmlDebugObjectReference &child, obj.children) {
+ foreach (const QQmlEngineDebugObjectReference &child, obj.children) {
QVERIFY(!child.className.isEmpty());
QVERIFY(child.properties.count() > 0);
}
- QmlDebugObjectReference rect;
- QmlDebugObjectReference text;
- foreach (const QmlDebugObjectReference &child, obj.children) {
+ QQmlEngineDebugObjectReference rect;
+ QQmlEngineDebugObjectReference text;
+ foreach (const QQmlEngineDebugObjectReference &child, obj.children) {
QVERIFY(!child.className.isEmpty());
if (child.className == "Rectangle")
rect = child;
@@ -856,7 +857,7 @@ void tst_QQmlEngineDebugService::queryObjectsForLocation()
QCOMPARE(findProperty(text.properties, "color").value, qVariantFromValue(QColor("blue")));
} else {
- foreach (const QmlDebugObjectReference &child, obj.children) {
+ foreach (const QQmlEngineDebugObjectReference &child, obj.children) {
QVERIFY(!child.className.isEmpty());
QCOMPARE(child.properties.count(), 0);
}
@@ -873,7 +874,7 @@ void tst_QQmlEngineDebugService::queryObjectsForLocation_data()
void tst_QQmlEngineDebugService::regression_QTCREATORBUG_7451()
{
- QmlDebugObjectReference rootObject = findRootObject();
+ QQmlEngineDebugObjectReference rootObject = findRootObject();
QVERIFY(!rootObject.className.isEmpty());
int contextId = rootObject.contextDebugId;
QQmlContext *context = qobject_cast<QQmlContext *>(QQmlDebugService::objectForId(contextId));
@@ -900,7 +901,7 @@ void tst_QQmlEngineDebugService::regression_QTCREATORBUG_7451()
QVERIFY(success);
QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
- foreach (QmlDebugObjectReference child, rootObject.children) {
+ foreach (QQmlEngineDebugObjectReference child, rootObject.children) {
QVERIFY(!child.className.isEmpty());
success = false;
lineNumber = child.source.lineNumber;
@@ -923,7 +924,7 @@ void tst_QQmlEngineDebugService::regression_QTCREATORBUG_7451()
QVERIFY(success);
QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
- foreach (QmlDebugObjectReference child, rootObject.children) {
+ foreach (QQmlEngineDebugObjectReference child, rootObject.children) {
QVERIFY(!child.className.isEmpty());
success = false;
lineNumber = child.source.lineNumber;
@@ -939,7 +940,7 @@ void tst_QQmlEngineDebugService::queryObjectWithNonStreamableTypes()
{
bool success;
- QmlDebugObjectReference rootObject = findRootObject(4, true);
+ QQmlEngineDebugObjectReference rootObject = findRootObject(4, true);
QVERIFY(!rootObject.className.isEmpty());
QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(nullptr);
@@ -951,7 +952,7 @@ void tst_QQmlEngineDebugService::queryObjectWithNonStreamableTypes()
QVERIFY(success);
QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
- QmlDebugObjectReference obj = m_dbg->object();
+ QQmlEngineDebugObjectReference obj = m_dbg->object();
QVERIFY(!obj.className.isEmpty());
QCOMPARE(findProperty(obj.properties, "modelIndex").value,
@@ -962,14 +963,14 @@ void tst_QQmlEngineDebugService::jsonData()
{
bool success;
- QmlDebugObjectReference rootObject = findRootObject(5, true);
+ QQmlEngineDebugObjectReference rootObject = findRootObject(5, true);
QVERIFY(!rootObject.className.isEmpty());
m_dbg->queryObject(rootObject, &success);
QVERIFY(success);
QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
- QmlDebugObjectReference obj = m_dbg->object();
+ QQmlEngineDebugObjectReference obj = m_dbg->object();
QVERIFY(!obj.className.isEmpty());
QCOMPARE(findProperty(obj.properties, "data").value,
@@ -1064,10 +1065,10 @@ void tst_QQmlEngineDebugService::queryExpressionResultBC_data()
void tst_QQmlEngineDebugService::setBindingForObject()
{
- QmlDebugObjectReference rootObject = findRootObject();
+ QQmlEngineDebugObjectReference rootObject = findRootObject();
QVERIFY(!rootObject.className.isEmpty());
QVERIFY(rootObject.debugId != -1);
- QmlDebugPropertyReference widthPropertyRef = findProperty(rootObject.properties, "width");
+ QQmlEngineDebugPropertyReference widthPropertyRef = findProperty(rootObject.properties, "width");
QCOMPARE(widthPropertyRef.value, QVariant(10));
QCOMPARE(widthPropertyRef.binding, QString());
@@ -1112,7 +1113,7 @@ void tst_QQmlEngineDebugService::setBindingForObject()
rootObject = findRootObject();
QVERIFY(!rootObject.className.isEmpty());
QCOMPARE(rootObject.children.size(), 5); // Rectangle, Text, MouseArea, Component.onCompleted, NonScriptPropertyElement
- QmlDebugObjectReference mouseAreaObject = rootObject.children.at(2);
+ QQmlEngineDebugObjectReference mouseAreaObject = rootObject.children.at(2);
QVERIFY(!mouseAreaObject.className.isEmpty());
m_dbg->queryObjectRecursive(mouseAreaObject, &success);
QVERIFY(success);
@@ -1120,7 +1121,7 @@ void tst_QQmlEngineDebugService::setBindingForObject()
mouseAreaObject = m_dbg->object();
QCOMPARE(mouseAreaObject.className, QString("MouseArea"));
- QmlDebugPropertyReference onEnteredRef = findProperty(mouseAreaObject.properties, "onEntered");
+ QQmlEngineDebugPropertyReference onEnteredRef = findProperty(mouseAreaObject.properties, "onEntered");
QCOMPARE(onEnteredRef.name, QString("onEntered"));
// Sorry, can't do that anymore: QCOMPARE(onEnteredRef.value, QVariant("{ console.log('hello') }"));
@@ -1149,10 +1150,10 @@ void tst_QQmlEngineDebugService::setBindingForObject()
void tst_QQmlEngineDebugService::resetBindingForObject()
{
- QmlDebugObjectReference rootObject = findRootObject();
+ QQmlEngineDebugObjectReference rootObject = findRootObject();
QVERIFY(!rootObject.className.isEmpty());
QVERIFY(rootObject.debugId != -1);
- QmlDebugPropertyReference widthPropertyRef = findProperty(rootObject.properties, "width");
+ QQmlEngineDebugPropertyReference widthPropertyRef = findProperty(rootObject.properties, "width");
bool success = false;
@@ -1188,7 +1189,7 @@ void tst_QQmlEngineDebugService::resetBindingForObject()
rootObject = findRootObject();
QVERIFY(!rootObject.className.isEmpty());
- QmlDebugPropertyReference boldPropertyRef = findProperty(rootObject.properties, "font.bold");
+ QQmlEngineDebugPropertyReference boldPropertyRef = findProperty(rootObject.properties, "font.bold");
QCOMPARE(boldPropertyRef.value.toBool(), false);
QCOMPARE(boldPropertyRef.binding, QString());
@@ -1200,7 +1201,7 @@ void tst_QQmlEngineDebugService::setBindingInStates()
const int sourceIndex = 3;
- QmlDebugObjectReference obj = findRootObject(sourceIndex);
+ QQmlEngineDebugObjectReference obj = findRootObject(sourceIndex);
QVERIFY(!obj.className.isEmpty());
QVERIFY(obj.debugId != -1);
QVERIFY(obj.children.count() >= 2);
@@ -1233,11 +1234,11 @@ void tst_QQmlEngineDebugService::setBindingInStates()
// change the binding
- QmlDebugObjectReference state = obj.children[1];
+ QQmlEngineDebugObjectReference state = obj.children[1];
QCOMPARE(state.className, QString("State"));
QVERIFY(state.children.count() > 0);
- QmlDebugObjectReference propertyChange = state.children[0];
+ QQmlEngineDebugObjectReference propertyChange = state.children[0];
QVERIFY(!propertyChange.className.isEmpty());
QVERIFY(propertyChange.debugId != -1);
@@ -1316,43 +1317,43 @@ void tst_QQmlEngineDebugService::queryObjectTree()
{
const int sourceIndex = 3;
- QmlDebugObjectReference obj = findRootObject(sourceIndex, true);
+ QQmlEngineDebugObjectReference obj = findRootObject(sourceIndex, true);
QVERIFY(!obj.className.isEmpty());
QVERIFY(obj.debugId != -1);
QVERIFY(obj.children.count() >= 2);
// check state
- QmlDebugObjectReference state = obj.children[1];
+ QQmlEngineDebugObjectReference state = obj.children[1];
QCOMPARE(state.className, QString("State"));
QVERIFY(state.children.count() > 0);
- QmlDebugObjectReference propertyChange = state.children[0];
+ QQmlEngineDebugObjectReference propertyChange = state.children[0];
QVERIFY(!propertyChange.className.isEmpty());
QVERIFY(propertyChange.debugId != -1);
- QmlDebugPropertyReference propertyChangeTarget = findProperty(propertyChange.properties,"target");
+ QQmlEngineDebugPropertyReference propertyChangeTarget = findProperty(propertyChange.properties,"target");
QCOMPARE(propertyChangeTarget.objectDebugId, propertyChange.debugId);
- QmlDebugObjectReference targetReference = qvariant_cast<QmlDebugObjectReference>(propertyChangeTarget.value);
+ QQmlEngineDebugObjectReference targetReference = qvariant_cast<QQmlEngineDebugObjectReference>(propertyChangeTarget.value);
QVERIFY(!targetReference.className.isEmpty());
QCOMPARE(targetReference.debugId, -1);
QCOMPARE(targetReference.name, QString("<unnamed object>"));
// check transition
- QmlDebugObjectReference transition = obj.children[0];
+ QQmlEngineDebugObjectReference transition = obj.children[0];
QCOMPARE(transition.className, QString("Transition"));
QCOMPARE(findProperty(transition.properties,"from").value.toString(), QString("*"));
QCOMPARE(findProperty(transition.properties,"to").value, findProperty(state.properties,"name").value);
QVERIFY(transition.children.count() > 0);
- QmlDebugObjectReference animation = transition.children[0];
+ QQmlEngineDebugObjectReference animation = transition.children[0];
QVERIFY(!animation.className.isEmpty());
QVERIFY(animation.debugId != -1);
- QmlDebugPropertyReference animationTarget = findProperty(animation.properties,"target");
+ QQmlEngineDebugPropertyReference animationTarget = findProperty(animation.properties,"target");
QCOMPARE(animationTarget.objectDebugId, animation.debugId);
- targetReference = qvariant_cast<QmlDebugObjectReference>(animationTarget.value);
+ targetReference = qvariant_cast<QQmlEngineDebugObjectReference>(animationTarget.value);
QVERIFY(!targetReference.className.isEmpty());
QCOMPARE(targetReference.debugId, -1);
QCOMPARE(targetReference.name, QString("<unnamed object>"));
@@ -1362,7 +1363,7 @@ void tst_QQmlEngineDebugService::queryObjectTree()
}
void tst_QQmlEngineDebugService::asynchronousCreate() {
- QmlDebugObjectReference object;
+ QQmlEngineDebugObjectReference object;
auto connection = connect(m_dbg, &QQmlEngineDebugClient::newObject, this, [&](int objectId) {
object.debugId = objectId;
});
diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h
deleted file mode 100644
index 5d74f2d43c..0000000000
--- a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQMLENGINEDEBUGCLIENT_H
-#define QQMLENGINEDEBUGCLIENT_H
-
-#include <private/qqmldebugclient_p.h>
-#include <private/qpacket_p.h>
-
-#include <QtCore/qurl.h>
-#include <QtCore/qvariant.h>
-
-struct QmlDebugPropertyReference
-{
- QmlDebugPropertyReference()
- : objectDebugId(-1), hasNotifySignal(false)
- {
- }
-
- QmlDebugPropertyReference &operator=(
- const QmlDebugPropertyReference &o)
- {
- objectDebugId = o.objectDebugId; name = o.name; value = o.value;
- valueTypeName = o.valueTypeName; binding = o.binding;
- hasNotifySignal = o.hasNotifySignal;
- return *this;
- }
-
- int objectDebugId;
- QString name;
- QVariant value;
- QString valueTypeName;
- QString binding;
- bool hasNotifySignal;
-};
-
-struct QmlDebugFileReference
-{
- QmlDebugFileReference()
- : lineNumber(-1), columnNumber(-1)
- {
- }
-
- QmlDebugFileReference &operator=(
- const QmlDebugFileReference &o)
- {
- url = o.url; lineNumber = o.lineNumber; columnNumber = o.columnNumber;
- return *this;
- }
-
- QUrl url;
- int lineNumber;
- int columnNumber;
-};
-
-struct QmlDebugObjectReference
-{
- QmlDebugObjectReference()
- : debugId(-1), contextDebugId(-1)
- {
- }
-
- QmlDebugObjectReference(int id)
- : debugId(id), contextDebugId(-1)
- {
- }
-
- QmlDebugObjectReference &operator=(
- const QmlDebugObjectReference &o)
- {
- debugId = o.debugId; className = o.className; idString = o.idString;
- name = o.name; source = o.source; contextDebugId = o.contextDebugId;
- properties = o.properties; children = o.children;
- return *this;
- }
- int debugId;
- QString className;
- QString idString;
- QString name;
- QmlDebugFileReference source;
- int contextDebugId;
- QList<QmlDebugPropertyReference> properties;
- QList<QmlDebugObjectReference> children;
-};
-
-Q_DECLARE_METATYPE(QmlDebugObjectReference)
-
-struct QmlDebugContextReference
-{
- QmlDebugContextReference()
- : debugId(-1)
- {
- }
-
- QmlDebugContextReference &operator=(
- const QmlDebugContextReference &o)
- {
- debugId = o.debugId; name = o.name; objects = o.objects;
- contexts = o.contexts;
- return *this;
- }
-
- int debugId;
- QString name;
- QList<QmlDebugObjectReference> objects;
- QList<QmlDebugContextReference> contexts;
-};
-
-struct QmlDebugEngineReference
-{
- QmlDebugEngineReference()
- : debugId(-1)
- {
- }
-
- QmlDebugEngineReference(int id)
- : debugId(id)
- {
- }
-
- QmlDebugEngineReference &operator=(
- const QmlDebugEngineReference &o)
- {
- debugId = o.debugId; name = o.name;
- return *this;
- }
-
- int debugId;
- QString name;
-};
-
-class QQmlEngineDebugClient : public QQmlDebugClient
-{
- Q_OBJECT
-public:
- explicit QQmlEngineDebugClient(QQmlDebugConnection *conn);
-
- quint32 addWatch(const QmlDebugPropertyReference &,
- bool *success);
- quint32 addWatch(const QmlDebugContextReference &, const QString &,
- bool *success);
- quint32 addWatch(const QmlDebugObjectReference &, const QString &,
- bool *success);
- quint32 addWatch(const QmlDebugObjectReference &,
- bool *success);
- quint32 addWatch(const QmlDebugFileReference &,
- bool *success);
-
- void removeWatch(quint32 watch, bool *success);
-
- quint32 queryAvailableEngines(bool *success);
- quint32 queryRootContexts(const QmlDebugEngineReference &,
- bool *success);
- quint32 queryObject(const QmlDebugObjectReference &,
- bool *success);
- quint32 queryObjectsForLocation(const QString &file,
- int lineNumber, int columnNumber, bool *success);
- quint32 queryObjectRecursive(const QmlDebugObjectReference &,
- bool *success);
- quint32 queryObjectsForLocationRecursive(const QString &file,
- int lineNumber, int columnNumber, bool *success);
- quint32 queryExpressionResult(int objectDebugId,
- const QString &expr,
- bool *success);
- quint32 queryExpressionResultBC(int objectDebugId,
- const QString &expr,
- bool *success);
- quint32 setBindingForObject(int objectDebugId, const QString &propertyName,
- const QVariant &bindingExpression,
- bool isLiteralValue,
- QString source, int line, bool *success);
- quint32 resetBindingForObject(int objectDebugId,
- const QString &propertyName, bool *success);
- quint32 setMethodBody(int objectDebugId, const QString &methodName,
- const QString &methodBody, bool *success);
-
- quint32 getId() { return m_nextId++; }
-
- void decode(QPacket &ds, QmlDebugContextReference &);
- void decode(QPacket &ds, QmlDebugObjectReference &, bool simple);
- void decode(QPacket &ds, QList<QmlDebugObjectReference> &o, bool simple);
-
- QList<QmlDebugEngineReference> engines() { return m_engines; }
- QmlDebugContextReference rootContext() { return m_rootContext; }
- QmlDebugObjectReference object() { return m_object; }
- QList<QmlDebugObjectReference> objects() { return m_objects; }
- QVariant resultExpr() { return m_exprResult; }
- bool valid() { return m_valid; }
-
-signals:
- void newObject(int objectId);
- void valueChanged(QByteArray,QVariant);
- void result();
-
-protected:
- void messageReceived(const QByteArray &);
-
-private:
- quint32 m_nextId;
- bool m_valid;
- QList<QmlDebugEngineReference> m_engines;
- QmlDebugContextReference m_rootContext;
- QmlDebugObjectReference m_object;
- QList<QmlDebugObjectReference> m_objects;
- QVariant m_exprResult;
-};
-
-#endif // QQMLENGINEDEBUGCLIENT_H
diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.pri b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.pri
deleted file mode 100644
index a969b4f153..0000000000
--- a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.pri
+++ /dev/null
@@ -1,3 +0,0 @@
-HEADERS += $$PWD/qqmlenginedebugclient.h
-
-SOURCES += $$PWD/qqmlenginedebugclient.cpp