Home · All Classes · Modules

QDBusVariant Class Reference
[QtDBus module]

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

Methods

Special Methods


Detailed Description

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;
     arguments << QVariant(42) << QVariant.fromValue(QDBusVariant(43)) << QVariant("hello");
     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
     QVariant v = callMyDBusFunction();
     // 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.


Method Documentation

QDBusVariant.__init__ (self)

Constructs a new D-Bus variant.

QDBusVariant.__init__ (self, QVariant variant)

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

See also setVariant().

QDBusVariant.__init__ (self, QDBusVariant)

QDBusVariant.setVariant (self, QVariant variant)

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

See also variant().

QVariant QDBusVariant.variant (self)

Returns this D-Bus variant as a QVariant object.

See also setVariant().

bool QDBusVariant.__eq__ (self, QDBusVariant v2)

bool QDBusVariant.__ne__ (self, QDBusVariant v2)


PyQt 4.12.3 for X11Copyright © Riverbank Computing Ltd and The Qt Company 2015Qt 4.8.7