PySide6.QtDBus.QDBusPendingCall¶
- class QDBusPendingCall¶
QDBusPendingCall类指的是一个待处理的异步调用。更多…概要¶
方法¶
def
__init__()def
error()def
isError()def
isFinished()def
isValid()def
reply()def
swap()
静态函数¶
def
fromError()
注意
本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。
详细描述¶
一个
QDBusPendingCall对象是对通过D-Bus发送的方法调用的引用,而不等待回复。QDBusPendingCall是一个不透明的类型,旨在用作待处理回复的句柄。在大多数程序中,
QDBusPendingCall类不会直接使用。为了访问回复的内容或等待其完成,可以安全地使用基于模板的QDBusPendingReply来替代。QDBusPendingCallWatcher类允许连接到信号,该信号将指示回复何时到达或调用是否超时。它还提供了waitForFinished()方法,该方法将暂停程序的执行,直到回复到达。注意
如果你创建了一个
QDBusPendingCall对象的副本,所有信息将在多个副本之间共享。因此,QDBusPendingCall是一个显式共享的对象,并且不提供分离副本的方法(因为它们引用的是同一个待处理的调用)另请参阅
QDBusPendingReplyQDBusPendingCallWatcher- __init__(other)¶
- Parameters:
其他 –
QDBusPendingCall
创建
other挂起的异步调用的副本。请注意,两个对象将引用相同的挂起调用。- error()¶
- Return type:
- static fromCompletedCall(message)¶
- Parameters:
消息 –
QDBusMessage- Return type:
基于消息
msg创建一个QDBusPendingCall对象。该消息必须是ErrorMessage或ReplyMessage类型(即典型的已完成调用的消息)。此函数对于需要模拟挂起调用但已经完成的代码非常有用。
另请参阅
- static fromError(error)¶
- Parameters:
错误 –
QDBusError- Return type:
基于错误条件
error创建一个QDBusPendingCall对象。生成的待处理调用对象将处于“完成”状态,并且QDBusPendingReply::isError() 将返回 true。 另请参阅
- isError()¶
- Return type:
布尔
- isFinished()¶
- Return type:
布尔
- isValid()¶
- Return type:
布尔
- reply()¶
- Return type:
- swap(other)¶
- Parameters:
其他 –
QDBusPendingCall
将此挂起的调用实例与
other交换。此函数非常快且永远不会失败。- waitForFinished()¶