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:
parent
02b18343e1
commit
276d633626
@ -343,18 +343,46 @@ QJsonValue &QJsonValue::operator =(const QJsonValue &other)
|
|||||||
|
|
||||||
The conversion will convert QVariant types as follows:
|
The conversion will convert QVariant types as follows:
|
||||||
|
|
||||||
\list
|
\table
|
||||||
\li QMetaType::Bool to Bool
|
\header
|
||||||
\li QMetaType::Int
|
\li Source type
|
||||||
\li QMetaType::Double
|
\li Destination type
|
||||||
\li QMetaType::LongLong
|
\row
|
||||||
\li QMetaType::ULongLong
|
\li
|
||||||
\li QMetaType::UInt to Double
|
\list
|
||||||
\li QMetaType::QString to String
|
\li QMetaType::Bool
|
||||||
\li QMetaType::QStringList
|
\endlist
|
||||||
\li QMetaType::QVariantList to Array
|
\li QJsonValue::Bool
|
||||||
\li QMetaType::QVariantMap to Object
|
\row
|
||||||
\endlist
|
\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
|
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.
|
is empty, a Null QJsonValue will be stored, otherwise a String value using the returned QString.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user