- class QDBusVariant¶
The
QDBusVariant
class enables the programmer to identify the variant type provided by the D-Bus typesystem. More…Synopsis¶
Methods¶
def
__init__()
def
__eq__()
def
setVariant()
def
swap()
def
variant()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description¶
Warning
This section contains snippets that were automatically translated from C++ to Python and may contain errors.
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
setArguments()
):arguments = QList() 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 v = callMyDBusFunction() # retrieve the D-Bus variant dbusVariant = QDBusVariant(v) # retrieve the actual value stored in the D-Bus variant 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
- __init__()¶
Constructs a new D-Bus variant.
- __init__(variant)
- Parameters:
variant – object
Constructs a new D-Bus variant from the given Qt
variant
.See also
- __eq__(v2)¶
- Parameters:
v2 –
QDBusVariant
- Return type:
bool
- setVariant(variant)¶
- Parameters:
variant – object
Assigns the value of the given Qt
variant
to this D-Bus variant.See also
- swap(other)¶
- Parameters:
other –
QDBusVariant
Swaps this
QDBusVariant
instance withother
.- variant()¶
- Return type:
object
Returns this D-Bus variant as a QVariant object.
See also