[Qt-interest] qt-4.5.3 examples/dbus/remotecontrolledcar issue with objectRegisteredAt

Giacomo giacomo.strangolino at elettra.trieste.it
Wed Nov 25 08:56:29 CET 2009


Hi to all.

Playing with DBUS and the example under examples/dbus/remotecontrolledcar
qt-x11-opensource version 4.5.3, I inserted into controller/controller.cpp
the following line, inside

Controller::on_accelerate_clicked():

qDebug() << "Object registered at" << car->connection().objectRegisteredAt(
      QLatin1String("/Car"));

this always prints a NULL QObject (0x0)

Well, according to the documentation of objectRegisteredAt()

"Return the object that was registered with the registerObject() at the object 
path given by path."

and in the example above, car/main.cpp calls

new CarAdaptor(car);
QDBusConnection connection = QDBusConnection::sessionBus();
connection.registerObject(QLatin1String("/Car"), car);

where path is "/Car".

Not fully convinced, I replaced "/Car" with "/com/trolltech/CarExample/Car",
both in car/main.cpp and in the objectRegisteredAt() invocation.

(And also in Controller constructor, to make the example still work:
   car = new CarInterface("com.trolltech.CarExample", 
"/com/trolltech/CarExample/Car",...
   -controller/controller.cpp- )

Still qDebug() prints out (0x0).

Is this the expected behaviour? Or am I wrongly using the 
objectRegisteredAt()?

Thanks in advance.

Giacomo.



More information about the Qt-interest-old mailing list