diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2020-03-05 07:17:45 -0800 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-03-20 21:18:00 +0000 |
commit | c798b286bdef4026b222e4e030faa36387e32d65 (patch) | |
tree | c2689d240232b3ebf60f3abe51f4ab740906cec7 /src/corelib/serialization | |
parent | d41d8297c8e74b8e4b684039c13e86b23cce11ea (diff) |
Doc: update QJsonObject::operator[] non-const to say it creates key
the non-const QJsonArray::operator[] requires a valid index and all the
const operator[] say that it returns Undefined if the key or index
doesn't exist. This is the exception.
Task-number: QTBUG-39864
Change-Id: Iaa63461109844e978376fffd15f9716f0cc66cca
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/serialization')
-rw-r--r-- | src/corelib/serialization/qjsonobject.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/serialization/qjsonobject.cpp b/src/corelib/serialization/qjsonobject.cpp index a6987279d3..aceb465920 100644 --- a/src/corelib/serialization/qjsonobject.cpp +++ b/src/corelib/serialization/qjsonobject.cpp @@ -401,7 +401,9 @@ QJsonValue QJsonObject::operator [](const QString &key) const #if QT_STRINGVIEW_LEVEL < 2 /*! - Returns a reference to the value for \a key. + Returns a reference to the value for \a key. If there is no value with key + \a key in the object, one is created with a QJsonValue::Null value and then + returned. The return value is of type QJsonValueRef, a helper class for QJsonArray and QJsonObject. When you get an object of type QJsonValueRef, you can |