diff options
author | Sze Howe Koh <szehowe.koh@gmail.com> | 2014-02-21 22:31:51 +0800 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-04 15:59:05 +0100 |
commit | 276d633626ea9a52dc5d28b9dafbfa5345f35521 (patch) | |
tree | 476abc2eca8dc5462bd3deae79ea3076e71a824d /src | |
parent | 02b18343e104512979edcc5d9ffa97cc16fe5123 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/json/qjsonvalue.cpp | 52 |
1 files changed, 40 insertions, 12 deletions
diff --git a/src/corelib/json/qjsonvalue.cpp b/src/corelib/json/qjsonvalue.cpp index 487a431b8f..e5194f7336 100644 --- a/src/corelib/json/qjsonvalue.cpp +++ b/src/corelib/json/qjsonvalue.cpp @@ -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. |