summaryrefslogtreecommitdiff
path: root/src/webchannel/qmetaobjectpublisher.cpp
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@theqtcompany.com>2015-09-23 06:52:01 +0000
committerAndy Shaw <andy.shaw@theqtcompany.com>2015-09-29 14:49:34 +0000
commit906d910415454d64ff0b021b06f0df422a8c82bd (patch)
tree0226d1338d1ee7c03555d3e7c17261df8dd392d9 /src/webchannel/qmetaobjectpublisher.cpp
parent6a7de61bc15d0cde3a3c91c58f45ba10957aa39b (diff)
downloadqtwebchannel-5.5.tar.gz
Compile when QML is disabled5.5
Since QJSValue is part of the QML module then it should check if that is available before using it so we add a QT_NO_JSVALUE define to help with this. Task-number: QTBUG-46850 Change-Id: I1974518a5c134dbb8508a46505b43c820a7a700a Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Diffstat (limited to 'src/webchannel/qmetaobjectpublisher.cpp')
-rw-r--r--src/webchannel/qmetaobjectpublisher.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/webchannel/qmetaobjectpublisher.cpp b/src/webchannel/qmetaobjectpublisher.cpp
index 0cad569..22df02b 100644
--- a/src/webchannel/qmetaobjectpublisher.cpp
+++ b/src/webchannel/qmetaobjectpublisher.cpp
@@ -41,7 +41,9 @@
#include <QDebug>
#include <QJsonObject>
#include <QJsonArray>
+#ifndef QT_NO_JSVALUE
#include <QJSValue>
+#endif
#include <QUuid>
QT_BEGIN_NAMESPACE
@@ -486,12 +488,14 @@ QJsonValue QMetaObjectPublisher::wrapResult(const QVariant &result, QWebChannelA
if (!classInfo.isEmpty())
objectInfo[KEY_DATA] = classInfo;
return objectInfo;
+#ifndef QT_NO_JSVALUE
} else if (result.canConvert<QJSValue>()) {
// Workaround for keeping QJSValues from QVariant.
// Calling QJSValue::toVariant() converts JS-objects/arrays to QVariantMap/List
// instead of stashing a QJSValue itself into a variant.
// TODO: Improve QJSValue-QJsonValue conversion in Qt.
return wrapResult(result.value<QJSValue>().toVariant(), transport, parentObjectId);
+#endif
} else if (result.canConvert<QVariantList>()) {
// recurse and potentially wrap contents of the array
return wrapList(result.toList(), transport);