usServer和DBusClientInterface
1) 创建一个QDBusInterface的实例
QDBusInterface iface( "hotel.server",
"/hotel/path",
"hotel.interface", QDBusConnection::sessionBus());
if (!iface.isValid()) {
qDebug() << qPrintable(QDBusConnection::sessionBus().lastError().message());
exit(1);
}
2) 传递参数
int num_room;
num_room= this->ui->checkInlineEdit->text().toInt();
3) 呼叫远程的checkIn,参数为num_room
QDBusReply reply = iface.call("checkIn", num_room);
4) 判断返回值
if (reply.isValid()) {
num_room = reply.value();
qDebug("Got %d %s\n", num_room, (num_room > 1) "rooms" : "room");
} else {
qDebug( "Check In fail!\n");
}