6.0.0-rc4Source

QDBusPendingReply Class

template <typename... Types> class QDBusPendingReply

The QDBusPendingReply class contains the reply to an asynchronous method call. More…

Header#include <QDBusPendingReply>
CMaketarget_link_libraries(app PRIVATE Nt::DBus)
ModuleNt D-Bus C++ Classes
InheritsQDBusPendingReplyBase

List of all members, including inherited members

Public Types

typedefSelect

Public Functions

QDBusPendingReply()
QDBusPendingReply(const QDBusPendingCall &call)
QDBusPendingReply(const QDBusMessage &message)
QDBusPendingReply &operator=(const QDBusPendingCall &call)
QDBusPendingReply &operator=(const QDBusMessage &message)
QVariantargumentAt(int index) const
Select<Index>argumentAt() const
Select<0>value() const
operator Select<0>() const

Static Public Members

intcount()

Detailed Description

The template arguments are the types of the reply's arguments:

QDBusPendingReply<QString, int> reply = iface.asyncCall("Status");
reply.waitForFinished();
if (reply.isValid()) {
    QString state = reply.argumentAt<0>();
    int load = reply.argumentAt<1>();
}

When the call finishes, the reply's signature is checked against the types; a reply that does not match becomes an InvalidSignature error.

See also QDBusPendingCall and QDBusReply.

Differences from Qt

It is a variadic template, so it accepts any number of types. There is no QDBusPendingReplyData.

Member Type Documentation

template <int Index>typedef QDBusPendingReply::Select

The type of the reply's argument at the index Index.

Member Function Documentation

QDBusPendingReply::QDBusPendingReply()

Constructs an object that waits for no call.

QDBusPendingReply::QDBusPendingReply(const QDBusPendingCall &call)

Constructs a reply that follows the call call.

QDBusPendingReply::QDBusPendingReply(const QDBusMessage &message)

Constructs a reply that is complete and holds message.

QVariant QDBusPendingReply::argumentAt(int index) const

Returns the reply's argument at index as a QVariant, which may hold a QDBusArgument. The call must be finished.

template <int Index>Select<Index> QDBusPendingReply::argumentAt() const

Returns the reply's argument at Index as its own type. The call must be finished; the function waits for it if it is not.

[static, constexpr] int QDBusPendingReply::count()

Returns the number of arguments that the reply has.

QDBusPendingReply::operator Select<0>() const

Returns the first argument of the reply, waiting for the call if necessary.

QDBusPendingReply & QDBusPendingReply::operator=(const QDBusPendingCall &call)

Makes this reply follow the call call and returns a reference to it.

QDBusPendingReply & QDBusPendingReply::operator=(const QDBusMessage &message)

Makes this reply hold message and returns a reference to it.

Select<0> QDBusPendingReply::value() const

Returns the first argument of the reply, waiting for the call if necessary.