summaryrefslogtreecommitdiffstats
path: root/src/corelib/serialization/qjsonarray.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2024-01-27 10:00:25 +0100
committerMarc Mutz <marc.mutz@qt.io>2024-01-29 22:44:37 +0100
commit264d54953e8b53f2454fbf8361b851923b8115a5 (patch)
treeef3cc357291af0673173a6207995bb9703945629 /src/corelib/serialization/qjsonarray.cpp
parent297341396203c5afed6420fa3789485c0996f846 (diff)
QJsonArray: symmetrize QDataStream op>>/<<
In operator<<(), stream the QJsonDocument directly, instead of toJson(Compact). This is how QJsonDocument operator<<() also does things, but that knowledge should be need-to-know, and QJsonArray doesn't, seeing as operator>>() just streams a QJsonDocument, and then calls toArray(). Pick-to: 6.7 6.6 6.5 Change-Id: Ia378bf0fb04ce33e3af24a2ce67778e89c41e31a Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/corelib/serialization/qjsonarray.cpp')
-rw-r--r--src/corelib/serialization/qjsonarray.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/corelib/serialization/qjsonarray.cpp b/src/corelib/serialization/qjsonarray.cpp
index b4e6631e36f..517ac116a6d 100644
--- a/src/corelib/serialization/qjsonarray.cpp
+++ b/src/corelib/serialization/qjsonarray.cpp
@@ -1076,9 +1076,7 @@ QDebug operator<<(QDebug dbg, const QJsonArray &a)
#ifndef QT_NO_DATASTREAM
QDataStream &operator<<(QDataStream &stream, const QJsonArray &array)
{
- QJsonDocument doc{array};
- stream << doc.toJson(QJsonDocument::Compact);
- return stream;
+ return stream << QJsonDocument{array};
}
QDataStream &operator>>(QDataStream &stream, QJsonArray &array)