From 50e857a9cbb2d41a85e85e1c10e18bd761569b88 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Sun, 21 Feb 2021 20:27:46 +0100 Subject: [PATCH] QJsonValueRef: add missing operator[] Change-Id: Iae165cd7bb2a7ea02d819fa25e0618d81f9a54f4 Reviewed-by: Thiago Macieira --- src/corelib/serialization/qjsonvalue.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/corelib/serialization/qjsonvalue.h b/src/corelib/serialization/qjsonvalue.h index a9dd86df19..4b59dede01 100644 --- a/src/corelib/serialization/qjsonvalue.h +++ b/src/corelib/serialization/qjsonvalue.h @@ -180,6 +180,10 @@ public: QJsonArray toArray() const; QJsonObject toObject() const; + const QJsonValue operator[](QStringView key) const { return toValue()[key]; } + const QJsonValue operator[](QLatin1String key) const { return toValue()[key]; } + const QJsonValue operator[](qsizetype i) const { return toValue()[i]; } + inline bool operator==(const QJsonValue &other) const { return toValue() == other; } inline bool operator!=(const QJsonValue &other) const { return toValue() != other; }