API reference - Class QVariant

Notation used in Ruby API documentation

Module: QtCore

Description: This class represents the QVariant namespace

Sub-classes: Type, QFlags_Type

Public constructors

new QVariant ptrnewCreates a new object of this class

Public methods

[const]QVariant ptr_const_castReturns a non-const reference 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.
voidassign(const QVariant other)Assigns another object to self
[const]new QVariant ptrdupCreates a copy of self

Public static methods and constants

[static,const]QVariant_TypeBitArrayEnum constant QVariant::BitArray
[static,const]QVariant_TypeBitmapEnum constant QVariant::Bitmap
[static,const]QVariant_TypeBoolEnum constant QVariant::Bool
[static,const]QVariant_TypeBrushEnum constant QVariant::Brush
[static,const]QVariant_TypeByteArrayEnum constant QVariant::ByteArray
[static,const]QVariant_TypeCharEnum constant QVariant::Char
[static,const]QVariant_TypeColorEnum constant QVariant::Color
[static,const]QVariant_TypeCursorEnum constant QVariant::Cursor
[static,const]QVariant_TypeDateEnum constant QVariant::Date
[static,const]QVariant_TypeDateTimeEnum constant QVariant::DateTime
[static,const]QVariant_TypeDoubleEnum constant QVariant::Double
[static,const]QVariant_TypeFontEnum constant QVariant::Font
[static,const]QVariant_TypeHashEnum constant QVariant::Hash
[static,const]QVariant_TypeIconEnum constant QVariant::Icon
[static,const]QVariant_TypeImageEnum constant QVariant::Image
[static,const]QVariant_TypeIntEnum constant QVariant::Int
[static,const]QVariant_TypeInvalidEnum constant QVariant::Invalid
[static,const]QVariant_TypeKeySequenceEnum constant QVariant::KeySequence
[static,const]QVariant_TypeLastCoreTypeEnum constant QVariant::LastCoreType
[static,const]QVariant_TypeLastGuiTypeEnum constant QVariant::LastGuiType
[static,const]QVariant_TypeLastTypeEnum constant QVariant::LastType
[static,const]QVariant_TypeLineEnum constant QVariant::Line
[static,const]QVariant_TypeLineFEnum constant QVariant::LineF
[static,const]QVariant_TypeListEnum constant QVariant::List
[static,const]QVariant_TypeLocaleEnum constant QVariant::Locale
[static,const]QVariant_TypeLongLongEnum constant QVariant::LongLong
[static,const]QVariant_TypeMapEnum constant QVariant::Map
[static,const]QVariant_TypeMatrixEnum constant QVariant::Matrix
[static,const]QVariant_TypeMatrix4x4Enum constant QVariant::Matrix4x4
[static,const]QVariant_TypePaletteEnum constant QVariant::Palette
[static,const]QVariant_TypePenEnum constant QVariant::Pen
[static,const]QVariant_TypePixmapEnum constant QVariant::Pixmap
[static,const]QVariant_TypePointEnum constant QVariant::Point
[static,const]QVariant_TypePointFEnum constant QVariant::PointF
[static,const]QVariant_TypePolygonEnum constant QVariant::Polygon
[static,const]QVariant_TypeQuaternionEnum constant QVariant::Quaternion
[static,const]QVariant_TypeRectEnum constant QVariant::Rect
[static,const]QVariant_TypeRectFEnum constant QVariant::RectF
[static,const]QVariant_TypeRegExpEnum constant QVariant::RegExp
[static,const]QVariant_TypeRegionEnum constant QVariant::Region
[static,const]QVariant_TypeSizeEnum constant QVariant::Size
[static,const]QVariant_TypeSizeFEnum constant QVariant::SizeF
[static,const]QVariant_TypeSizePolicyEnum constant QVariant::SizePolicy
[static,const]QVariant_TypeStringEnum constant QVariant::String
[static,const]QVariant_TypeStringListEnum constant QVariant::StringList
[static,const]QVariant_TypeTextFormatEnum constant QVariant::TextFormat
[static,const]QVariant_TypeTextLengthEnum constant QVariant::TextLength
[static,const]QVariant_TypeTimeEnum constant QVariant::Time
[static,const]QVariant_TypeTransformEnum constant QVariant::Transform
[static,const]QVariant_TypeUIntEnum constant QVariant::UInt
[static,const]QVariant_TypeULongLongEnum constant QVariant::ULongLong
[static,const]QVariant_TypeUrlEnum constant QVariant::Url
[static,const]QVariant_TypeUserTypeEnum constant QVariant::UserType
[static,const]QVariant_TypeVector2DEnum constant QVariant::Vector2D
[static,const]QVariant_TypeVector3DEnum constant QVariant::Vector3D
[static,const]QVariant_TypeVector4DEnum constant QVariant::Vector4D

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

BitArray

Signature: [static,const] QVariant_Type BitArray

Description: Enum constant QVariant::BitArray

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

Bitmap

Signature: [static,const] QVariant_Type Bitmap

Description: Enum constant QVariant::Bitmap

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

Bool

Signature: [static,const] QVariant_Type Bool

Description: Enum constant QVariant::Bool

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

Brush

Signature: [static,const] QVariant_Type Brush

Description: Enum constant QVariant::Brush

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

ByteArray

Signature: [static,const] QVariant_Type ByteArray

Description: Enum constant QVariant::ByteArray

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

Char

Signature: [static,const] QVariant_Type Char

Description: Enum constant QVariant::Char

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

Color

Signature: [static,const] QVariant_Type Color

Description: Enum constant QVariant::Color

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

Cursor

Signature: [static,const] QVariant_Type Cursor

Description: Enum constant QVariant::Cursor

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

Date

Signature: [static,const] QVariant_Type Date

Description: Enum constant QVariant::Date

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

DateTime

Signature: [static,const] QVariant_Type DateTime

Description: Enum constant QVariant::DateTime

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

Double

Signature: [static,const] QVariant_Type Double

Description: Enum constant QVariant::Double

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

Font

Signature: [static,const] QVariant_Type Font

Description: Enum constant QVariant::Font

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

Hash

Signature: [static,const] QVariant_Type Hash

Description: Enum constant QVariant::Hash

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

Icon

Signature: [static,const] QVariant_Type Icon

Description: Enum constant QVariant::Icon

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

Image

Signature: [static,const] QVariant_Type Image

Description: Enum constant QVariant::Image

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

Int

Signature: [static,const] QVariant_Type Int

Description: Enum constant QVariant::Int

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

Invalid

Signature: [static,const] QVariant_Type Invalid

Description: Enum constant QVariant::Invalid

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

KeySequence

Signature: [static,const] QVariant_Type KeySequence

Description: Enum constant QVariant::KeySequence

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

LastCoreType

Signature: [static,const] QVariant_Type LastCoreType

Description: Enum constant QVariant::LastCoreType

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

LastGuiType

Signature: [static,const] QVariant_Type LastGuiType

Description: Enum constant QVariant::LastGuiType

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

LastType

Signature: [static,const] QVariant_Type LastType

Description: Enum constant QVariant::LastType

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

Line

Signature: [static,const] QVariant_Type Line

Description: Enum constant QVariant::Line

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

LineF

Signature: [static,const] QVariant_Type LineF

Description: Enum constant QVariant::LineF

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

List

Signature: [static,const] QVariant_Type List

Description: Enum constant QVariant::List

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

Locale

Signature: [static,const] QVariant_Type Locale

Description: Enum constant QVariant::Locale

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

LongLong

Signature: [static,const] QVariant_Type LongLong

Description: Enum constant QVariant::LongLong

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

Map

Signature: [static,const] QVariant_Type Map

Description: Enum constant QVariant::Map

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

Matrix

Signature: [static,const] QVariant_Type Matrix

Description: Enum constant QVariant::Matrix

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

Matrix4x4

Signature: [static,const] QVariant_Type Matrix4x4

Description: Enum constant QVariant::Matrix4x4

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

Palette

Signature: [static,const] QVariant_Type Palette

Description: Enum constant QVariant::Palette

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

Pen

Signature: [static,const] QVariant_Type Pen

Description: Enum constant QVariant::Pen

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

Pixmap

Signature: [static,const] QVariant_Type Pixmap

Description: Enum constant QVariant::Pixmap

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

Point

Signature: [static,const] QVariant_Type Point

Description: Enum constant QVariant::Point

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

PointF

Signature: [static,const] QVariant_Type PointF

Description: Enum constant QVariant::PointF

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

Polygon

Signature: [static,const] QVariant_Type Polygon

Description: Enum constant QVariant::Polygon

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

Quaternion

Signature: [static,const] QVariant_Type Quaternion

Description: Enum constant QVariant::Quaternion

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

Rect

Signature: [static,const] QVariant_Type Rect

Description: Enum constant QVariant::Rect

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

RectF

Signature: [static,const] QVariant_Type RectF

Description: Enum constant QVariant::RectF

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

RegExp

Signature: [static,const] QVariant_Type RegExp

Description: Enum constant QVariant::RegExp

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

Region

Signature: [static,const] QVariant_Type Region

Description: Enum constant QVariant::Region

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

Size

Signature: [static,const] QVariant_Type Size

Description: Enum constant QVariant::Size

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

SizeF

Signature: [static,const] QVariant_Type SizeF

Description: Enum constant QVariant::SizeF

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

SizePolicy

Signature: [static,const] QVariant_Type SizePolicy

Description: Enum constant QVariant::SizePolicy

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

String

Signature: [static,const] QVariant_Type String

Description: Enum constant QVariant::String

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

StringList

Signature: [static,const] QVariant_Type StringList

Description: Enum constant QVariant::StringList

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

TextFormat

Signature: [static,const] QVariant_Type TextFormat

Description: Enum constant QVariant::TextFormat

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

TextLength

Signature: [static,const] QVariant_Type TextLength

Description: Enum constant QVariant::TextLength

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

Time

Signature: [static,const] QVariant_Type Time

Description: Enum constant QVariant::Time

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

Transform

Signature: [static,const] QVariant_Type Transform

Description: Enum constant QVariant::Transform

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

UInt

Signature: [static,const] QVariant_Type UInt

Description: Enum constant QVariant::UInt

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

ULongLong

Signature: [static,const] QVariant_Type ULongLong

Description: Enum constant QVariant::ULongLong

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

Url

Signature: [static,const] QVariant_Type Url

Description: Enum constant QVariant::Url

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

UserType

Signature: [static,const] QVariant_Type UserType

Description: Enum constant QVariant::UserType

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

Vector2D

Signature: [static,const] QVariant_Type Vector2D

Description: Enum constant QVariant::Vector2D

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

Vector3D

Signature: [static,const] QVariant_Type Vector3D

Description: Enum constant QVariant::Vector3D

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

Vector4D

Signature: [static,const] QVariant_Type Vector4D

Description: Enum constant QVariant::Vector4D

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

_const_cast

Signature: [const] QVariant ptr _const_cast

Description: Returns a non-const reference to self.

Basically, this method allows turning a const object reference to a non-const one. This method is provided as last resort to remove the constness from an object. Usually there is a good reason for a const object reference, so using this method may have undesired side effects.

This method has been introduced in version 0.29.6.

_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: void assign (const QVariant other)

Description: Assigns another object to self

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 QVariant ptr dup

Description: Creates a copy of self

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

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

Signature: [static] new QVariant ptr new

Description: Creates a new object of this class

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