QDBusVariant Class
The QDBusVariant class enables the programmer to identify the variant type provided by the D-Bus typesystem. More…
| Header | #include <QDBusVariant> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::DBus) |
| Module | Nt D-Bus C++ Classes |
List of all members, including inherited members
Public Functions
| QDBusVariant() | |
| QDBusVariant(const QVariant &variant) | |
| QVariant | variant() const |
| void | setVariant(const QVariant &variant) |
| void | swap(QDBusVariant &other) |
Detailed Description
A QVariant in a message carries a value of its own type. To send a D-Bus variant, which carries its type on the wire, wrap the value in a QDBusVariant:
QDBusMessage m = QDBusMessage::createMethodCall(service, path,
"org.freedesktop.DBus.Properties", "Set");
m << "org.example.Clock" << "Volume" << QVariant::fromValue(QDBusVariant(7));
See also QDBusArgument.
Differences from Qt
There is no QDebug stream operator.
Member Function Documentation
QDBusVariant::QDBusVariant()
Constructs a QDBusVariant that holds an invalid QVariant.
QDBusVariant::QDBusVariant(const QVariant &variant)
Constructs a QDBusVariant that holds a copy of variant.
void QDBusVariant::setVariant(const QVariant &variant)
Replaces the value in this variant with variant.
void QDBusVariant::swap(QDBusVariant &other)
Swaps this variant with other.
QVariant QDBusVariant::variant() const
Returns the value in this variant.