aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-05-26 01:00:14 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-05-26 01:00:14 +0200
commit9ff4c5c2168fcc616770389ee826190708258114 (patch)
tree2db3d972e2a6e2bf16cf0280e074ffa00aaa55f1 /src/plugins
parent30b3b8a7603a9963d17cf8520fda7252841cda91 (diff)
parent9a44e3b6ca81f0e84d774a95e45b449b5d4cb583 (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp63
1 files changed, 37 insertions, 26 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp
index d008b86a78..17bae6d695 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp
+++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp
@@ -55,6 +55,11 @@
#include <QtCore/qdebug.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/qfileinfo.h>
+#include <QtCore/qjsonvalue.h>
+#include <QtCore/qjsonobject.h>
+#include <QtCore/qjsonarray.h>
+#include <QtCore/qjsondocument.h>
+
#include <private/qmetaobject_p.h>
#include <private/qqmldebugconnector_p.h>
#include <private/qversionedpacket_p.h>
@@ -211,34 +216,40 @@ QVariant QQmlEngineDebugServiceImpl::valueContents(QVariant value) const
return contents;
}
- if (QQmlValueTypeFactory::isValueType(userType)) {
- switch (userType) {
- case QMetaType::QRect:
- case QMetaType::QRectF:
- case QMetaType::QPoint:
- case QMetaType::QPointF:
- case QMetaType::QSize:
- case QMetaType::QSizeF:
- case QMetaType::QFont:
- // Don't call the toString() method on those. The stream operators are better.
- return value;
- default:
- break;
- }
-
- const QMetaObject *mo = QQmlValueTypeFactory::metaObjectForMetaType(userType);
- if (mo) {
- int toStringIndex = mo->indexOfMethod("toString()");
- if (toStringIndex != -1) {
- QMetaMethod mm = mo->method(toStringIndex);
- QString s;
- if (mm.invokeOnGadget(value.data(), Q_RETURN_ARG(QString, s)))
- return s;
+ switch (userType) {
+ case QMetaType::QRect:
+ case QMetaType::QRectF:
+ case QMetaType::QPoint:
+ case QMetaType::QPointF:
+ case QMetaType::QSize:
+ case QMetaType::QSizeF:
+ case QMetaType::QFont:
+ // Don't call the toString() method on those. The stream operators are better.
+ return value;
+ case QMetaType::QJsonValue:
+ return value.toJsonValue().toVariant();
+ case QMetaType::QJsonObject:
+ return value.toJsonObject().toVariantMap();
+ case QMetaType::QJsonArray:
+ return value.toJsonArray().toVariantList();
+ case QMetaType::QJsonDocument:
+ return value.toJsonDocument().toVariant();
+ default:
+ if (QQmlValueTypeFactory::isValueType(userType)) {
+ const QMetaObject *mo = QQmlValueTypeFactory::metaObjectForMetaType(userType);
+ if (mo) {
+ int toStringIndex = mo->indexOfMethod("toString()");
+ if (toStringIndex != -1) {
+ QMetaMethod mm = mo->method(toStringIndex);
+ QString s;
+ if (mm.invokeOnGadget(value.data(), Q_RETURN_ARG(QString, s)))
+ return s;
+ }
}
- }
- // We expect all QML value types to either have a toString() method or stream operators
- return value;
+ // We expect all QML value types to either have a toString() method or stream operators
+ return value;
+ }
}
if (QQmlMetaType::isQObject(userType)) {