QDBusPendingCall 类

The QDBusPendingCall class refers to one pending asynchronous call 更多...

头: #include <QDBusPendingCall>
qmake: QT += dbus
Since: Qt 4.5
继承者: QDBusPendingCallWatcher and QDBusPendingReply

公共函数

QDBusPendingCall (const QDBusPendingCall & other )
~QDBusPendingCall ()
void swap (QDBusPendingCall & other )
QDBusPendingCall & operator= (QDBusPendingCall && other )
QDBusPendingCall & operator= (const QDBusPendingCall & other )

静态公共成员

QDBusPendingCall fromCompletedCall (const QDBusMessage & msg )
QDBusPendingCall fromError (const QDBusError & error )

详细描述

The QDBusPendingCall class refers to one pending asynchronous call

A QDBusPendingCall object is a reference to a method call that was sent over D-Bus without waiting for a reply. QDBusPendingCall is an opaque type, meant to be used as a handle for a pending reply.

In most programs, the QDBusPendingCall class will not be used directly. It can be safely replaced with the template-based QDBusPendingReply , in order to access the contents of the reply or wait for it to be complete.

The QDBusPendingCallWatcher class allows one to connect to a signal that will indicate when the reply has arrived or if the call has timed out. It also provides the QDBusPendingCallWatcher::waitForFinished () method which will suspend the execution of the program until the reply has arrived.

注意: If you create a copy of a QDBusPendingCall object, all information will be shared among the many copies. Therefore, QDBusPendingCall is an explicitly-shared object and does not provide a method of detaching the copies (since they refer to the same pending call)

另请参阅 QDBusPendingReply , QDBusPendingCallWatcher ,和 QDBusAbstractInterface::asyncCall ().

成员函数文档编制

QDBusPendingCall:: QDBusPendingCall (const QDBusPendingCall & other )

创建副本为 other pending asynchronous call. Note that both objects will refer to the same pending call.

QDBusPendingCall:: ~QDBusPendingCall ()

Destroys this copy of the QDBusPendingCall object. If this copy is also the last copy of a pending asynchronous call, the call will be canceled and no further notifications will be received. There will be no way of accessing the reply's contents when it arrives.

[static] QDBusPendingCall QDBusPendingCall:: fromCompletedCall (const QDBusMessage & msg )

创建 QDBusPendingCall object based on the message msg . The message must be of type QDBusMessage::ErrorMessage or QDBusMessage::ReplyMessage (that is, a message that is typical of a completed call).

This function is useful for code that requires simulating a pending call, but that has already finished.

该函数在 Qt 4.6 引入。

另请参阅 fromError ().

[static] QDBusPendingCall QDBusPendingCall:: fromError (const QDBusError & error )

创建 QDBusPendingCall object based on the error condition error . The resulting pending call object will be in the "finished" state and QDBusPendingReply::isError () will return true.

该函数在 Qt 4.6 引入。

另请参阅 fromCompletedCall ().

void QDBusPendingCall:: swap ( QDBusPendingCall & other )

Swaps this pending call instance with other 。此函数非常快且从不失败。

该函数在 Qt 5.0 引入。

QDBusPendingCall &QDBusPendingCall:: operator= ( QDBusPendingCall && other )

移动赋值运算符。

QDBusPendingCall &QDBusPendingCall:: operator= (const QDBusPendingCall & other )

创建副本为 other pending asynchronous call and drops the reference to the previously-referenced call. Note that both objects will refer to the same pending call after this function.

If this object contained the last reference of a pending asynchronous call, the call will be canceled and no further notifications will be received. There will be no way of accessing the reply's contents when it arrives.