summaryrefslogtreecommitdiffstats
path: root/src/corelib/serialization/qjsoncbor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/serialization/qjsoncbor.cpp')
-rw-r--r--src/corelib/serialization/qjsoncbor.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/corelib/serialization/qjsoncbor.cpp b/src/corelib/serialization/qjsoncbor.cpp
index 8bb04fa3bf..e0eab74a02 100644
--- a/src/corelib/serialization/qjsoncbor.cpp
+++ b/src/corelib/serialization/qjsoncbor.cpp
@@ -679,17 +679,22 @@ static void appendVariant(QCborContainerPrivate *d, const QVariant &variant)
\row \li \l QUuid \li Uuid
\endtable
- For any other types, this function will return Null if the QVariant itself
- is null, and otherwise will try to convert to string using
- QVariant::toString(). If the conversion to string fails, this function
- returns Undefined.
+ If QVariant::isNull() returns true, a null QCborValue is returned or
+ inserted into the list or object, regardless of the type carried by
+ QVariant. Note the behavior change in Qt 6.0 affecting QVariant::isNull()
+ also affects this function.
+
+ For other types not listed above, a conversion to string will be attempted,
+ usually but not always by calling QVariant::toString(). If the conversion
+ fails the value is replaced by an Undefined CBOR value. Note that
+ QVariant::toString() is also lossy for the majority of types.
Please note that the conversions via QVariant::toString() are subject to
- change at any time. QCborValue may be extended in the future to support
- more types, which will result in a change in how this function performs
- conversions.
+ change at any time. Both QVariant and QCborValue may be extended in the
+ future to support more types, which will result in a change in how this
+ function performs conversions.
- \sa toVariant(), fromJsonValue(), QCborArray::toVariantList(), QCborMap::toVariantMap()
+ \sa toVariant(), fromJsonValue(), QCborArray::toVariantList(), QCborMap::toVariantMap(), QJsonValue::fromVariant()
*/
QCborValue QCborValue::fromVariant(const QVariant &variant)
{