From 75cb6f59f1f55f3494bc601bcafc93fcdce58a19 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 11 Mar 2015 14:47:48 +0100 Subject: [PATCH] Add QJsonValueRef::toVariant() to better mirror the API of QJsonValue Task-number: QTBUG-43686 Change-Id: I83edecf5226d44980a8a442a512a13ab9b2ac6a9 Reviewed-by: Thiago Macieira --- src/corelib/json/qjsonvalue.cpp | 5 +++++ src/corelib/json/qjsonvalue.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/corelib/json/qjsonvalue.cpp b/src/corelib/json/qjsonvalue.cpp index c8ddfbc2cc..ae6a3678bd 100644 --- a/src/corelib/json/qjsonvalue.cpp +++ b/src/corelib/json/qjsonvalue.cpp @@ -704,6 +704,11 @@ QJsonValueRef &QJsonValueRef::operator =(const QJsonValueRef &ref) return *this; } +QVariant QJsonValueRef::toVariant() const +{ + return toValue().toVariant(); +} + QJsonArray QJsonValueRef::toArray() const { return toValue().toArray(); diff --git a/src/corelib/json/qjsonvalue.h b/src/corelib/json/qjsonvalue.h index b7e77e4b19..372ae85290 100644 --- a/src/corelib/json/qjsonvalue.h +++ b/src/corelib/json/qjsonvalue.h @@ -146,6 +146,7 @@ public: QJsonValueRef &operator = (const QJsonValue &val); QJsonValueRef &operator = (const QJsonValueRef &val); + QVariant toVariant() const; inline QJsonValue::Type type() const { return toValue().type(); } inline bool isNull() const { return type() == QJsonValue::Null; } inline bool isBool() const { return type() == QJsonValue::Bool; }