API reference - Class QJsonValue

Notation used in Ruby API documentation

Module: QtCore

Description: Binding of QJsonValue

Sub-classes: Type, QFlags_Type

Public constructors

new QJsonValuenew(const QJsonValue_Type arg1 = QJsonValue::Null)Constructor QJsonValue::QJsonValue(QJsonValue::Type)
new QJsonValuenew(bool b)Constructor QJsonValue::QJsonValue(bool b)
new QJsonValuenew(double n)Constructor QJsonValue::QJsonValue(double n)
new QJsonValuenew(long long n)Constructor QJsonValue::QJsonValue(qint64 n)
new QJsonValuenew(string s)Constructor QJsonValue::QJsonValue(const QString &s)
new QJsonValuenew(const QJsonArray a)Constructor QJsonValue::QJsonValue(const QJsonArray &a)
new QJsonValuenew(const QJsonObject o)Constructor QJsonValue::QJsonValue(const QJsonObject &o)
new QJsonValuenew(const QJsonValue other)Constructor QJsonValue::QJsonValue(const QJsonValue &other)

Public methods

[const]bool!=(const QJsonValue other)Method bool QJsonValue::operator!=(const QJsonValue &other)
[const]bool==(const QJsonValue other)Method bool QJsonValue::operator==(const QJsonValue &other)
[const]QJsonValue[](string key)Method const QJsonValue QJsonValue::operator[](const QString &key)
[const]QJsonValue[](int i)Method const QJsonValue QJsonValue::operator[](int i)
void_assign(const QJsonValue other)Assigns another object to self
void_createEnsures the C++ object is created
void_destroyExplicitly destroys the object
[const]bool_destroyed?Returns a value indicating whether the object was already destroyed
[const]bool_is_const_object?Returns a value indicating whether the reference is a const reference
void_manageMarks the object as managed by the script side.
void_unmanageMarks the object as no longer owned by the script side.
QJsonValueassign(const QJsonValue other)Method QJsonValue &QJsonValue::operator =(const QJsonValue &other)
[const]new QJsonValue ptrdupCreates a copy of self
[const]boolisArray?Method bool QJsonValue::isArray()
[const]boolisBool?Method bool QJsonValue::isBool()
[const]boolisDouble?Method bool QJsonValue::isDouble()
[const]boolisNull?Method bool QJsonValue::isNull()
[const]boolisObject?Method bool QJsonValue::isObject()
[const]boolisString?Method bool QJsonValue::isString()
[const]boolisUndefined?Method bool QJsonValue::isUndefined()
voidswap(QJsonValue other)Method void QJsonValue::swap(QJsonValue &other)
[const]QJsonArraytoArrayMethod QJsonArray QJsonValue::toArray()
[const]QJsonArraytoArray(const QJsonArray defaultValue)Method QJsonArray QJsonValue::toArray(const QJsonArray &defaultValue)
[const]booltoBool(bool defaultValue = false)Method bool QJsonValue::toBool(bool defaultValue)
[const]doubletoDouble(double defaultValue = 0)Method double QJsonValue::toDouble(double defaultValue)
[const]inttoInt(int defaultValue = 0)Method int QJsonValue::toInt(int defaultValue)
[const]QJsonObjecttoObjectMethod QJsonObject QJsonValue::toObject()
[const]QJsonObjecttoObject(const QJsonObject defaultValue)Method QJsonObject QJsonValue::toObject(const QJsonObject &defaultValue)
[const]stringtoStringMethod QString QJsonValue::toString()
[const]stringtoString(string defaultValue)Method QString QJsonValue::toString(const QString &defaultValue)
[const]varianttoVariantMethod QVariant QJsonValue::toVariant()
[const]QJsonValue_TypetypeMethod QJsonValue::Type QJsonValue::type()

Public static methods and constants

[static,const]QJsonValue_TypeArrayEnum constant QJsonValue::Array
[static,const]QJsonValue_TypeBoolEnum constant QJsonValue::Bool
[static,const]QJsonValue_TypeDoubleEnum constant QJsonValue::Double
[static,const]QJsonValue_TypeNullEnum constant QJsonValue::Null
[static,const]QJsonValue_TypeObjectEnum constant QJsonValue::Object
[static,const]QJsonValue_TypeStringEnum constant QJsonValue::String
[static,const]QJsonValue_TypeUndefinedEnum constant QJsonValue::Undefined
QJsonValuefromVariant(variant variant)Static method QJsonValue QJsonValue::fromVariant(const QVariant &variant)

Deprecated methods (protected, public, static, non-static and constructors)

voidcreateUse of this method is deprecated. Use _create instead
voiddestroyUse of this method is deprecated. Use _destroy instead
[const]booldestroyed?Use of this method is deprecated. Use _destroyed? instead
[const]boolis_const_object?Use of this method is deprecated. Use _is_const_object? instead

Detailed description

!=

Signature: [const] bool != (const QJsonValue other)

Description: Method bool QJsonValue::operator!=(const QJsonValue &other)

==

Signature: [const] bool == (const QJsonValue other)

Description: Method bool QJsonValue::operator==(const QJsonValue &other)

Array

Signature: [static,const] QJsonValue_Type Array

Description: Enum constant QJsonValue::Array

Python specific notes:
The object exposes a readable attribute 'Array'. This is the getter.

Bool

Signature: [static,const] QJsonValue_Type Bool

Description: Enum constant QJsonValue::Bool

Python specific notes:
The object exposes a readable attribute 'Bool'. This is the getter.

Double

Signature: [static,const] QJsonValue_Type Double

Description: Enum constant QJsonValue::Double

Python specific notes:
The object exposes a readable attribute 'Double'. This is the getter.

Null

Signature: [static,const] QJsonValue_Type Null

Description: Enum constant QJsonValue::Null

Python specific notes:
The object exposes a readable attribute 'Null'. This is the getter.

Object

Signature: [static,const] QJsonValue_Type Object

Description: Enum constant QJsonValue::Object

Python specific notes:
The object exposes a readable attribute 'Object'. This is the getter.

String

Signature: [static,const] QJsonValue_Type String

Description: Enum constant QJsonValue::String

Python specific notes:
The object exposes a readable attribute 'String'. This is the getter.

Undefined

Signature: [static,const] QJsonValue_Type Undefined

Description: Enum constant QJsonValue::Undefined

Python specific notes:
The object exposes a readable attribute 'Undefined'. This is the getter.

[]

(1) Signature: [const] QJsonValue [] (string key)

Description: Method const QJsonValue QJsonValue::operator[](const QString &key)

(2) Signature: [const] QJsonValue [] (int i)

Description: Method const QJsonValue QJsonValue::operator[](int i)

_assign

Signature: void _assign (const QJsonValue other)

Description: Assigns another object to self

_create

Signature: void _create

Description: Ensures the C++ object is created

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

_destroy

Signature: void _destroy

Description: Explicitly destroys the object

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

_destroyed?

Signature: [const] bool _destroyed?

Description: Returns a value indicating whether the object was already destroyed

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

_is_const_object?

Signature: [const] bool _is_const_object?

Description: Returns a value indicating whether the reference is a const reference

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

_manage

Signature: void _manage

Description: Marks the object as managed by the script side.

After calling this method on an object, the script side will be responsible for the management of the object. This method may be called if an object is returned from a C++ function and the object is known not to be owned by any C++ instance. If necessary, the script side may delete the object if the script's reference is no longer required.

Usually it's not required to call this method. It has been introduced in version 0.24.

_unmanage

Signature: void _unmanage

Description: Marks the object as no longer owned by the script side.

Calling this method will make this object no longer owned by the script's memory management. Instead, the object must be managed in some other way. Usually this method may be called if it is known that some C++ object holds and manages this object. Technically speaking, this method will turn the script's reference into a weak reference. After the script engine decides to delete the reference, the object itself will still exist. If the object is not managed otherwise, memory leaks will occur.

Usually it's not required to call this method. It has been introduced in version 0.24.

assign

Signature: QJsonValue assign (const QJsonValue other)

Description: Method QJsonValue &QJsonValue::operator =(const QJsonValue &other)

create

Signature: void create

Description: Ensures the C++ object is created

Use of this method is deprecated. Use _create instead

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

destroy

Signature: void destroy

Description: Explicitly destroys the object

Use of this method is deprecated. Use _destroy instead

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

destroyed?

Signature: [const] bool destroyed?

Description: Returns a value indicating whether the object was already destroyed

Use of this method is deprecated. Use _destroyed? instead

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

dup

Signature: [const] new QJsonValue ptr dup

Description: Creates a copy of self

Python specific notes:
This method also implements '__copy__' and '__deepcopy__'.

fromVariant

Signature: [static] QJsonValue fromVariant (variant variant)

Description: Static method QJsonValue QJsonValue::fromVariant(const QVariant &variant)

This method is static and can be called without an instance.

isArray?

Signature: [const] bool isArray?

Description: Method bool QJsonValue::isArray()

isBool?

Signature: [const] bool isBool?

Description: Method bool QJsonValue::isBool()

isDouble?

Signature: [const] bool isDouble?

Description: Method bool QJsonValue::isDouble()

isNull?

Signature: [const] bool isNull?

Description: Method bool QJsonValue::isNull()

isObject?

Signature: [const] bool isObject?

Description: Method bool QJsonValue::isObject()

isString?

Signature: [const] bool isString?

Description: Method bool QJsonValue::isString()

isUndefined?

Signature: [const] bool isUndefined?

Description: Method bool QJsonValue::isUndefined()

is_const_object?

Signature: [const] bool is_const_object?

Description: Returns a value indicating whether the reference is a const reference

Use of this method is deprecated. Use _is_const_object? instead

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

new

(1) Signature: [static] new QJsonValue new (const QJsonValue_Type arg1 = QJsonValue::Null)

Description: Constructor QJsonValue::QJsonValue(QJsonValue::Type)

This method creates an object of class QJsonValue.

Python specific notes:
This method is the default initializer of the object.

(2) Signature: [static] new QJsonValue new (bool b)

Description: Constructor QJsonValue::QJsonValue(bool b)

This method creates an object of class QJsonValue.

Python specific notes:
This method is the default initializer of the object.

(3) Signature: [static] new QJsonValue new (double n)

Description: Constructor QJsonValue::QJsonValue(double n)

This method creates an object of class QJsonValue.

Python specific notes:
This method is the default initializer of the object.

(4) Signature: [static] new QJsonValue new (long long n)

Description: Constructor QJsonValue::QJsonValue(qint64 n)

This method creates an object of class QJsonValue.

Python specific notes:
This method is the default initializer of the object.

(5) Signature: [static] new QJsonValue new (string s)

Description: Constructor QJsonValue::QJsonValue(const QString &s)

This method creates an object of class QJsonValue.

Python specific notes:
This method is the default initializer of the object.

(6) Signature: [static] new QJsonValue new (const QJsonArray a)

Description: Constructor QJsonValue::QJsonValue(const QJsonArray &a)

This method creates an object of class QJsonValue.

Python specific notes:
This method is the default initializer of the object.

(7) Signature: [static] new QJsonValue new (const QJsonObject o)

Description: Constructor QJsonValue::QJsonValue(const QJsonObject &o)

This method creates an object of class QJsonValue.

Python specific notes:
This method is the default initializer of the object.

(8) Signature: [static] new QJsonValue new (const QJsonValue other)

Description: Constructor QJsonValue::QJsonValue(const QJsonValue &other)

This method creates an object of class QJsonValue.

Python specific notes:
This method is the default initializer of the object.

swap

Signature: void swap (QJsonValue other)

Description: Method void QJsonValue::swap(QJsonValue &other)

toArray

(1) Signature: [const] QJsonArray toArray

Description: Method QJsonArray QJsonValue::toArray()

(2) Signature: [const] QJsonArray toArray (const QJsonArray defaultValue)

Description: Method QJsonArray QJsonValue::toArray(const QJsonArray &defaultValue)

toBool

Signature: [const] bool toBool (bool defaultValue = false)

Description: Method bool QJsonValue::toBool(bool defaultValue)

toDouble

Signature: [const] double toDouble (double defaultValue = 0)

Description: Method double QJsonValue::toDouble(double defaultValue)

toInt

Signature: [const] int toInt (int defaultValue = 0)

Description: Method int QJsonValue::toInt(int defaultValue)

toObject

(1) Signature: [const] QJsonObject toObject

Description: Method QJsonObject QJsonValue::toObject()

(2) Signature: [const] QJsonObject toObject (const QJsonObject defaultValue)

Description: Method QJsonObject QJsonValue::toObject(const QJsonObject &defaultValue)

toString

(1) Signature: [const] string toString

Description: Method QString QJsonValue::toString()

(2) Signature: [const] string toString (string defaultValue)

Description: Method QString QJsonValue::toString(const QString &defaultValue)

toVariant

Signature: [const] variant toVariant

Description: Method QVariant QJsonValue::toVariant()

type

Signature: [const] QJsonValue_Type type

Description: Method QJsonValue::Type QJsonValue::type()