QDBusReply Class

The QDBusReply class stores the reply for a method call to a remote object. More...

Header: #include <QDBusReply>
qmake: QT += dbus
Since: Qt 4.2

Public Functions

QDBusReply(const QDBusMessage &reply)
QDBusReply(const QDBusPendingCall &pcall)
QDBusReply(const QDBusPendingReply &reply)
QDBusReply(const QDBusError &dbusError = QDBusError())
const QDBusError &error()
const QDBusError &error() const
bool isValid() const
QDBusReply::Type value() const
QDBusReply::Type operator QDBusReply::Type() const
QDBusReply<T> &operator=(const QDBusMessage &reply)
QDBusReply<T> &operator=(const QDBusPendingCall &pcall)
QDBusReply<T> &operator=(const QDBusError &dbusError)
QDBusReply<T> &operator=(const QDBusReply<T> &other)

Detailed Description

The QDBusReply class stores the reply for a method call to a remote object.

A QDBusReply object is a subset of the QDBusMessage object that represents a method call's reply. It contains only the first output argument or the error code and is used by QDBusInterface-derived classes to allow returning the error code as the function's return argument.

It can be used in the following manner:


  QDBusReply<QString> reply = interface->call("RemoteMethod");
  if (reply.isValid())
      // use the returned value
      useValue(reply.value());
  else
      // call failed. Show an error condition.
      showError(reply.error());

If the remote method call cannot fail, you can skip the error checking:


  QString reply = interface->call("RemoteMethod");

However, if it does fail under those conditions, the value returned by QDBusReply<T>::value() is a default-constructed value. It may be indistinguishable from a valid return value.

QDBusReply objects are used for remote calls that have no output arguments or return values (i.e., they have a "void" return type). Use the isValid() function to test if the reply succeeded.

See also QDBusMessage and QDBusInterface.

Member Function Documentation

QDBusReply::QDBusReply(const QDBusMessage &reply)

Default constructs an instance of QDBusReply.

QDBusReply::QDBusReply(const QDBusPendingCall &pcall)

Default constructs an instance of QDBusReply.

QDBusReply::QDBusReply(const QDBusPendingReply &reply)

Default constructs an instance of QDBusReply.

QDBusReply::QDBusReply(const QDBusError &dbusError = QDBusError())

Default constructs an instance of QDBusReply.

const QDBusError &QDBusReply::error()

const QDBusError &QDBusReply::error() const

bool QDBusReply::isValid() const

QDBusReply::Type QDBusReply::value() const

QDBusReply::Type QDBusReply::operator QDBusReply::Type() const

QDBusReply<T> &QDBusReply::operator=(const QDBusMessage &reply)

Copy-assignment operator.

QDBusReply<T> &QDBusReply::operator=(const QDBusPendingCall &pcall)

Copy-assignment operator.

QDBusReply<T> &QDBusReply::operator=(const QDBusError &dbusError)

Copy-assignment operator.

QDBusReply<T> &QDBusReply::operator=(const QDBusReply<T> &other)

Copy-assignment operator.