convert xml to cpp with qdbusxml2cpp get error unknow type (uu)

536 Views Asked by At

I use qbusxml2cpp tool in Qt to convert xml to cpp class. I use the command below to convert a xml file named nm-device.xml (I get this xml file from network manager package v0.9.8.8)

qdbusxml2cpp -v -c Devices -p Devices.h:Devices.cpp nm-device.xml 

but I get error, here is the output:

Got unknown type `(uu)' You should add name="org.qtproject.QtDBus.QtTypeName" value="<type>"/> to the XML description

I've also search on Google and I know (uu) is a struct and I need to add the line below to xml file

name="org.qtproject.QtDBus.QtTypeName" value="<type>"/>

The question is What type i should use in my situation?

2

There are 2 best solutions below

0
On

I don't think there is a Qt type that specifically encapsulates two uint32 fields, so you might have to create a custom type and register it.

You can look at that part of a tutorial here https://techbase.kde.org/Development/Tutorials/D-Bus/CustomTypes#Edit_the_XML which is registering a custom type called "Message" and modifying the XML file accordingly.

0
On

I have just found my solution. it is

<annotation name="org.qtproject.QtDBus.QtTypeName" value="DeviceDBusStateReason"/>