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:
typedef struct s_MyStruct{
int i;
} MyStruct;
typedef struct s_MyStruct{
QString s;
int i;
} MyStruct;
To copy to clipboard, switch view to plain text mode
and I use it in a slot:
public Q_SLOTS:
QString sayHelloWorld
(MyStruct arg
);
public Q_SLOTS:
QString sayHelloWorld(MyStruct arg);
To copy to clipboard, switch view to plain text mode
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:
<method name="sayHelloWorld">
<arg type="s" direction="out"/>
<annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="MyStruct"/>
<arg name="c" type="(si)" direction="in"/>
<method name="sayHelloWorld">
<arg type="s" direction="out"/>
<annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="MyStruct"/>
<arg name="c" type="(si)" direction="in"/>
To copy to clipboard, switch view to plain text mode
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:
Q_DECLARE_METATYPE(MyStruct)
Q_DECLARE_METATYPE(MyStruct)
To copy to clipboard, switch view to plain text mode
- I defined the
QDBusArgument &operator<<(QDBusArgument &argument, const MyStruct &arg);
To copy to clipboard, switch view to plain text mode
and
const QDBusArgument &operator>>(const QDBusArgument &argument, MyStruct &arg);
To copy to clipboard, switch view to plain text mode
operators
- BUT when I want to register my structure on dbus with
qDBusRegisterMetaType<MyStruct>
qDBusRegisterMetaType<MyStruct>
To copy to clipboard, switch view to plain text mode
, I'm getting an error:
qmetatype.h:189: error: 'qt_metatype_id' is not a member of 'QMetaTypeId<s_MyStruct>'
qmetatype.h:189: error: 'qt_metatype_id' is not a member of 'QMetaTypeId<s_MyStruct>'
To copy to clipboard, switch view to plain text mode
What's wrong ?
Please, help me! Where is all of this well documented ? 
Thanks for all
Bookmarks