Qt DBus: Byte type in QVariant, QVariantMap?
Solved
General and Desktop
-
wrote on 30 Sept 2018, 16:23 last edited by VRonin 10 Jan 2018, 08:13
Hi, i am trying to implement the following DBus interface using Qt:
void RegisterEndpoint(object endpoint, dict properties)
possible properties:string UUID byte Codec array{byte} Capabilities
This is currently described in XML the following way:
<method name="RegisterEndpoint"> <arg name="endpoint" type="o" direction="in"/> <arg name="properties" type="a{sv}" direction="in"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method>
But when i call this method, i get an invalid arguments error.
I guess, the reason is, because QVariant cannot take a Byte type (converting to int instead):properties <3 items> QVariantMap & [0] "Capabilities" "À\020\204\200ÿÿ" key "Capabilities" QString value "À\020\204\200ÿÿ" QVariant (QByteArray) [1] "Codec" 2 key "Codec" QString value 2 QVariant (int) [2] "UUID" "0000110b-0000-1000-8000-00805f9b34fb" key "UUID" QString value "0000110b-0000-1000-8000-00805f9b34fb" QVariant (QString)
Can anyone help out with suggestions to realize this?
Many thanks in advance!
-
wrote on 1 Oct 2018, 08:12 last edited by
Solved: you have to create a QVariant like this:
QVariant::fromValue(uchar(0)) -- instead of QVariant var = uchar(0);
2/2