How pass QDBusObjectPath as argument in remote method call

Thiago Macieira thiago at kde.org
Thu Nov 26 08:28:08 PST 2009


Em Quinta-feira 26 Novembro 2009, às 13:29:39, Nirav Rabara escreveu:
>    // Shows error here
> 
>    removeDevPath.setPath = ("/org/bluez/806/hci0/dev_00_1C_EF_44_D6_1D");

The = in the line above is probably a typo. It is not correct.

>     interface.call("RemoveDevie", removeDevPath);

> error: QString is an inaccessible base of 'QDBusObjectPath'.

What happens here is that the call() function takes up to 8 QVariant 
parameters. QVariant has a series of implicit constructors for many types and 
one of them ins QString.

It does not have a constructor for QDBusObjectPath. And I apparently forgot to 
add a QDBusObjectPath::operator QVariant() const.

What you need to do is wrap the object in a QVariant, like so:

	interface.call("RemoveDevice", qVariantFromValue(removeDevPath));

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20091126/a427b178/attachment.pgp 


More information about the dbus mailing list