[Qt-interest] Fwd: A Qt-dbus question

振华张 zhenhua2000 at gmail.com
Wed Sep 1 15:59:39 CEST 2010


Hi,

I met a qt-dbus related problem and seek for your kindly help. I
declared DBus Object as follws and use qdbusxml2cpp to integrate it
with my Qt project. I wrote both C and python test case to call my
method on this interface. However, it always tell me No such method
existing on the interface. I am pretty much sure about the existence
of my object and path. Could anyone help on this?

My DBus XML file looks like:

<node>
   <interface name="org.MyObject">
       <method name="MyMethod">
       <arg direction="in" name="param" type="a(sy)" />
       <annotation name="com.trolltech.QtDBus.QtTypeName.In0"
value="QArrayOfData"/>
       <arg direction="out" name="value" type="y" />
     </method>
   </interface>
</node>

Where QArrayOfData is something like:

struct MyData {
   QString text;
   uchar icon;
};

Q_DECLARE_METATYPE(MyData)

struct MenuItemList{
   QList<MyData> items;
};

Q_DECLARE_METATYPE(QArrayOfData)


And my python test case likes:

         bus = dbus.SystemBus()
         obj = dbus.Interface(bus.get_object(":1.533", "/"), "org.MyObject"  )

         items = []
         ret = obj.MyMethod(items)

Thanks,
Zhenhua




More information about the Qt-interest-old mailing list