Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
src_corelib_kernel_qvariant.cpp File Reference

(11d69325605071a32d10ed4392c67e9a07445ada)

Go to the source code of this file.

Functions

 qDebug ("Type is %s", v.typeName())
 
v setValue (5)
 
v setValue (c)
 
 if (v.canConvert< MyCustomStruct >()) c = v.value<MyCustomStruct>()
 
v canConvert< int > ()
 
v canConvert< QString > ()
 
v setValue (s)
 
v canConvert< MyCustomStruct > ()
 
 if (variant.canConvert< QVariantList >())
 
mapping insert (7, "Seven")
 
mapping insert (11, "Eleven")
 
mapping insert (42, "Forty-two")
 
 if (variant.canConvert< QVariantHash >())
 

Variables

QDataStream out (...)
 [0]
 
QVariant v (123) = v.toInt() + 100
 [3]
 
int x = v.toInt()
 [0]
 
int z = v.toInt()
 
QVariant y = QVariant::fromValue(nullptr)
 
QVariant variant = color
 [1]
 
QColor color = variant.value<QColor>()
 [2]
 
int i = v.toInt()
 
QString s = v.toString()
 [6]
 
MyCustomStruct c
 
MyCustomStruct c2 = v.value<MyCustomStruct>()
 
QList< int > intList = {7, 11, 42}
 [7]
 
QHash< int, QStringmapping
 [9]
 

Function Documentation

◆ canConvert< int >()

v canConvert< int > ( )

◆ canConvert< MyCustomStruct >()

v canConvert< MyCustomStruct > ( )

◆ canConvert< QString >()

v canConvert< QString > ( )

◆ if() [1/3]

if ( v.canConvert< MyCustomStruct > ()) = v.value<MyCustomStruct>()

◆ if() [2/3]

if ( variant.canConvert< QVariantHash > ())

Definition at line 127 of file src_corelib_kernel_qvariant.cpp.

◆ if() [3/3]

if ( variant.canConvert< QVariantList > ())

Definition at line 99 of file src_corelib_kernel_qvariant.cpp.

◆ insert() [1/3]

mapping insert ( 11 ,
"Eleven"  )

◆ insert() [2/3]

mapping insert ( 42 ,
"Forty-two"  )

◆ insert() [3/3]

mapping insert ( 7 ,
"Seven"  )

◆ qDebug()

qDebug ( "Type is %s" ,
v. typeName() )

◆ setValue() [1/3]

v setValue ( 5 )

◆ setValue() [2/3]

v setValue ( c )

◆ setValue() [3/3]

v setValue ( s )

Variable Documentation

◆ c

MyCustomStruct c

Definition at line 51 of file src_corelib_kernel_qvariant.cpp.

Referenced by QXcbWMSupport::QXcbWMSupport().

◆ c2

MyCustomStruct c2 = v.value<MyCustomStruct>()

Definition at line 56 of file src_corelib_kernel_qvariant.cpp.

◆ color

[2]

[3]

Definition at line 34 of file src_corelib_kernel_qvariant.cpp.

◆ i

int i = v.toInt()

Definition at line 48 of file src_corelib_kernel_qvariant.cpp.

◆ intList

QList< int > intList = {7, 11, 42}

[7]

[9]

Definition at line 96 of file src_corelib_kernel_qvariant.cpp.

◆ mapping

[9]

[10]

Definition at line 121 of file src_corelib_kernel_qvariant.cpp.

◆ out

QDataStream out(...) ( ...)

[0]

◆ s

MyCustomStruct s = v.toString()

[6]

[7]

Definition at line 49 of file src_corelib_kernel_qvariant.cpp.

◆ v

QVariant v ( 123 ) = v.toInt() + 100

[3]

[4]

[5]

[6]

Definition at line 17 of file src_corelib_kernel_qvariant.cpp.

◆ variant

QVariant variant = color

[1]

[2]

Definition at line 32 of file src_corelib_kernel_qvariant.cpp.

◆ x

[0]

[1]

Definition at line 9 of file src_corelib_kernel_qvariant.cpp.

◆ y

◆ z

int z = v.toInt()

Definition at line 18 of file src_corelib_kernel_qvariant.cpp.