QDBusMetaType Class
The QDBusMetaType class allows you to register types for use with D-Bus. More…
| Header | #include <QDBusMetaType> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::DBus) |
| Module | Nt D-Bus C++ Classes |
List of all members, including inherited members
Public Types
| typedef | MarshallFunction |
| typedef | DemarshallFunction |
Static Public Members
| void | registerMarshallOperators(QMetaType metaType, MarshallFunction marshall, DemarshallFunction demarshall) |
| bool | marshall(QDBusArgument &argument, QMetaType metaType, const void *data) |
| bool | demarshall(const QDBusArgument &argument, QMetaType metaType, void *data) |
| QMetaType | signatureToMetaType(const char *signature) |
| const char * | typeToSignature(QMetaType metaType) |
Detailed Description
The basic D-Bus types, QStringList, QByteArray, QVariantList, QVariantMap and lists of the numbers and of QDBusObjectPath are known from the start. Register other types with qDBusRegisterMetaType():
qDBusRegisterMetaType<Fix>();
qDBusRegisterMetaType<QList<Fix>>();
See also QDBusArgument.
Differences from Qt
None.
Member Type Documentation
typedef QDBusMetaType::DemarshallFunction
The type of a function that reads a value from a QDBusArgument to the given address.
typedef QDBusMetaType::MarshallFunction
The type of a function that writes the value at the given address to a QDBusArgument.
Member Function Documentation
bool QDBusMetaType::demarshall(const QDBusArgument &argument, QMetaType metaType, void *data)
Reads a value of the type metaType from argument into data, which must hold a constructed value of that type. Returns false if the type is not registered.
bool QDBusMetaType::marshall(QDBusArgument &argument, QMetaType metaType, const void *data)
Writes the value of the type metaType at data to argument. Returns false if the type is not registered.
void QDBusMetaType::registerMarshallOperators(QMetaType metaType, MarshallFunction marshall, DemarshallFunction demarshall)
Registers marshall and demarshall as the functions that write and read values of the type metaType. qDBusRegisterMetaType() calls this function.
QMetaType QDBusMetaType::signatureToMetaType(const char *signature)
Returns the meta-type that values with the D-Bus signature are read into: the basic types and the types registered with QDBusMetaType, or QDBusArgument for any other valid single type. Returns an invalid QMetaType if signature is not a single complete type.
const char * QDBusMetaType::typeToSignature(QMetaType metaType)
Returns the D-Bus signature of values of the type metaType, or nullptr if the type is not known to the D-Bus type system.