diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-01-29 11:31:51 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-02-01 08:25:22 +0100 |
commit | ae4103a722b991c08932ca2df279d52f8eb56c42 (patch) | |
tree | 44a6fd4b57dbd9dfc857360985700170ccedaa49 | |
parent | f64a9054e3b049fff4eb258658a020b403196b53 (diff) | |
download | qtwebchannel-ae4103a722b991c08932ca2df279d52f8eb56c42.tar.gz |
Fix variant conversion after change in qtbase
A change to make QByteArray and QString iterable sequences,
changed the result of QVariant::canConvert<QVariantList> to true.
Change-Id: If4c335a60fde88cd8e921314f481f41188a3d9f2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r-- | src/webchannel/qmetaobjectpublisher.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/webchannel/qmetaobjectpublisher.cpp b/src/webchannel/qmetaobjectpublisher.cpp index e5be207..2bc9c3e 100644 --- a/src/webchannel/qmetaobjectpublisher.cpp +++ b/src/webchannel/qmetaobjectpublisher.cpp @@ -831,6 +831,9 @@ QJsonValue QMetaObjectPublisher::wrapResult(const QVariant &result, QWebChannelA // TODO: Improve QJSValue-QJsonValue conversion in Qt. return wrapResult(result.value<QJSValue>().toVariant(), transport, parentObjectId); #endif + } else if (result.metaType().id() == QMetaType::QString || + result.metaType().id() == QMetaType::QByteArray) { + // avoid conversion to QVariantList } else if (result.canConvert<QVariantList>()) { // recurse and potentially wrap contents of the array // *don't* use result.toList() as that *only* works for QVariantList and QStringList! |