Doc: Clarify QJsonValue::fromVariant() type conversions

It wasn't obvious before that many QMetaType types get converted to the
same QJsonValue type.

Change-Id: I7bb02cb10b6c8a873e291cdf1e16c6c821d51208
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
Sze Howe Koh 2014-02-21 22:31:51 +08:00 committed by The Qt Project
parent 02b18343e1
commit 276d633626

View File

@ -343,18 +343,46 @@ QJsonValue &QJsonValue::operator =(const QJsonValue &other)
The conversion will convert QVariant types as follows:
\list
\li QMetaType::Bool to Bool
\li QMetaType::Int
\li QMetaType::Double
\li QMetaType::LongLong
\li QMetaType::ULongLong
\li QMetaType::UInt to Double
\li QMetaType::QString to String
\li QMetaType::QStringList
\li QMetaType::QVariantList to Array
\li QMetaType::QVariantMap to Object
\endlist
\table
\header
\li Source type
\li Destination type
\row
\li
\list
\li QMetaType::Bool
\endlist
\li QJsonValue::Bool
\row
\li
\list
\li QMetaType::Int
\li QMetaType::UInt
\li QMetaType::LongLong
\li QMetaType::ULongLong
\li QMetaType::Double
\endlist
\li QJsonValue::Double
\row
\li
\list
\li QMetaType::QString
\endlist
\li QJsonValue::String
\row
\li
\list
\li QMetaType::QStringList
\li QMetaType::QVariantList
\endlist
\li QJsonValue::Array
\row
\li
\list
\li QMetaType::QVariantMap
\endlist
\li QJsonValue::Object
\endtable
For all other QVariant types a conversion to a QString will be attempted. If the returned string
is empty, a Null QJsonValue will be stored, otherwise a String value using the returned QString.