[Qt-interest] Dictionary structure returned by QDBusInterface
Thiago Macieira
thiago.macieira at trolltech.com
Wed Apr 8 08:49:24 CEST 2009
Sanderson Coelho wrote:
>Sure, there isn't GetOptions method in org.freedesktop.DBus.w
>This method, I created and put it on session bus.
>And it is called on:
>iface.call("GetOptions");
>
>That's what I would like to know.
>How can I set a variable with dictionary returned by code above.
My point is that I don't know what T should be if I don't know what that
method returns. And since it doesn't exist in the standard D-Bus
implementation, I can't check my local copy for that return type.
You mentioned it's a dictionary. So T is probably QMap<Key, T> or
QHash<Key, T> (both work fine). You need to register the type with QtDBus,
which means you must declare it as a metatype first.
typedef QHash<Foo, Bar> FooBarHash;
Q_DECLARE_METATYPE(FooBarHash)
And in code:
qDBusRegisterMetaType<QHash<Foo, Bar> >();
The exact types of Foo and Bar you get from the D-Bus type that your new
function is returning.
--
Thiago Macieira - thiago.macieira (AT) nokia.com
Senior Product Manager - Nokia, Qt Software
Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090408/3ab78831/attachment.bin
More information about the Qt-interest-old
mailing list