Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QDBusVariant Class Reference

\inmodule QtDBus More...

#include <qdbusextratypes.h>

+ Collaboration diagram for QDBusVariant:

Public Member Functions

 QDBusVariant () noexcept
 Constructs a new D-Bus variant.
 
 QDBusVariant (const QVariant &variant)
 Constructs a new D-Bus variant from the given Qt variant.
 
 QDBusVariant (QVariant &&v) noexcept
 
void swap (QDBusVariant &other) noexcept
 Swaps this QDBusVariant instance with other.
 
void setVariant (const QVariant &variant)
 Assigns the value of the given Qt variant to this D-Bus variant.
 
QVariant variant () const
 Returns this D-Bus variant as a QVariant object.
 

Detailed Description

\inmodule QtDBus

Since
4.2

The QDBusVariant class enables the programmer to identify the variant type provided by the D-Bus typesystem.

A D-Bus function that takes an integer, a D-Bus variant and a string as parameters can be called with the following argument list (see QDBusMessage::setArguments()):

QList<QVariant> arguments;
myDBusMessage.setArguments(arguments);

When a D-Bus function returns a D-Bus variant, it can be retrieved as follows:

// call a D-Bus function that returns a D-Bus variant
// retrieve the D-Bus variant
QDBusVariant dbusVariant = qvariant_cast<QDBusVariant>(v);
// retrieve the actual value stored in the D-Bus variant
QVariant result = dbusVariant.variant();

The QVariant within a QDBusVariant is required to distinguish between a normal D-Bus value and a value within a D-Bus variant.

See also
{The Qt D-Bus Type System}

Definition at line 128 of file qdbusextratypes.h.

Constructor & Destructor Documentation

◆ QDBusVariant() [1/3]

QDBusVariant::QDBusVariant ( )
inlinenoexcept

Constructs a new D-Bus variant.

Definition at line 132 of file qdbusextratypes.h.

◆ QDBusVariant() [2/3]

QDBusVariant::QDBusVariant ( const QVariant & variant)
inlineexplicit

Constructs a new D-Bus variant from the given Qt variant.

See also
setVariant()

Definition at line 148 of file qdbusextratypes.h.

◆ QDBusVariant() [3/3]

QDBusVariant::QDBusVariant ( QVariant && v)
inlineexplicitnoexcept

Definition at line 137 of file qdbusextratypes.h.

Member Function Documentation

◆ setVariant()

void QDBusVariant::setVariant ( const QVariant & variant)
inline

Assigns the value of the given Qt variant to this D-Bus variant.

See also
variant()

Definition at line 151 of file qdbusextratypes.h.

◆ swap()

void QDBusVariant::swap ( QDBusVariant & other)
inlinenoexcept

Swaps this QDBusVariant instance with other.

Definition at line 139 of file qdbusextratypes.h.

References other(), and QVariant::swap().

+ Here is the call graph for this function:

◆ variant()

QVariant QDBusVariant::variant ( ) const
inline

Returns this D-Bus variant as a QVariant object.

See also
setVariant()

Definition at line 143 of file qdbusextratypes.h.

Referenced by operator>>(), and QDBusAbstractInterfaceBase::qt_metacall().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: