From c798b286bdef4026b222e4e030faa36387e32d65 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 5 Mar 2020 07:17:45 -0800 Subject: [PATCH] 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 --- src/corelib/serialization/qjsonobject.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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