diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-02-21 20:27:46 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-02-26 09:10:31 +0100 |
commit | 50e857a9cbb2d41a85e85e1c10e18bd761569b88 (patch) | |
tree | 052fee1930a45364c03401f9629f9ef6d9cd78b1 /src | |
parent | d1fcc5d94a18041a288eaae3e09d7ea8409055b1 (diff) |
QJsonValueRef: add missing operator[]
Change-Id: Iae165cd7bb2a7ea02d819fa25e0618d81f9a54f4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/serialization/qjsonvalue.h | 4 |
1 files changed, 4 insertions, 0 deletions
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; } |