JuBe
26th March 2009, 15:38
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{
QString s;
int i;
} MyStruct;
and I use it in a slot:
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:
<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:
Q_DECLARE_METATYPE(MyStruct)
- I defined the
QDBusArgument &operator<<(QDBusArgument &argument, const MyStruct &arg); and
const QDBusArgument &operator>>(const QDBusArgument &argument, MyStruct &arg); operators
- BUT when I want to register my structure on dbus with
qDBusRegisterMetaType<MyStruct>, I'm getting an error:
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
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{
QString s;
int i;
} MyStruct;
and I use it in a slot:
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:
<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:
Q_DECLARE_METATYPE(MyStruct)
- I defined the
QDBusArgument &operator<<(QDBusArgument &argument, const MyStruct &arg); and
const QDBusArgument &operator>>(const QDBusArgument &argument, MyStruct &arg); operators
- BUT when I want to register my structure on dbus with
qDBusRegisterMetaType<MyStruct>, I'm getting an error:
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