Working with QDBus and custom types
Hi all,
I'm trying to get a small Qt apps working with DBus but there are some details I cannot find anywhere (perhaps I'm not looking after the right key words...)
1st.
In my app.h, I declare a structure:
Code:
typedef struct s_MyStruct{
int i;
} MyStruct;
and I use it in a slot:
Code:
public Q_SLOTS:
QString sayHelloWorld
(MyStruct arg
);
But when I use qdbuscpp2xml to generate the xml dbus interface of this application/service, this method using a structure does not appear whereas DBus has a structure type.
I found that I can add this by hand like this:
Code:
<method name="sayHelloWorld">
<arg type="s" direction="out"/>
<annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="MyStruct"/>
<arg name="c" type="(si)" direction="in"/>
I did not find any doc on Trolltech website for this so, where all of this is documented ?
2nd.
My second problem is when I'm trying to compile my application.
- I defined my structure to Qt MetaType with the macro:
Code:
Q_DECLARE_METATYPE(MyStruct)
- I defined the and operators
- BUT when I want to register my structure on dbus with
Code:
qDBusRegisterMetaType<MyStruct>
, I'm getting an error:
Code:
qmetatype.h:189: error: 'qt_metatype_id' is not a member of 'QMetaTypeId<s_MyStruct>'
What's wrong ?
Please, help me! Where is all of this well documented ? :confused:
Thanks for all
Re: Working with QDBus and custom types
your 2nd problem:
qDBusRegisterMetaType<mynamespace::MyStruct>
this was working 4me
Re: Working with QDBus and custom types
I tried your tips but this does not work anymore... :crying:
I'm working with Qt 4.5.0. Everything seem to be fine in my code according to several tutos or whatever but I'm still blocked by this error :mad: