QDBusPendingCallWatcher¶
The QDBusPendingCallWatcher
class provides a convenient way for waiting for asynchronous replies. More…
Detailed Description¶
The QDBusPendingCallWatcher
provides the finished()
signal that will be emitted when a reply arrives.
It is usually used like the following example:
async = iface.asyncCall("RemoteMethod", value1, value2) watcher = QDBusPendingCallWatcher(async, self) QObject.connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), self, SLOT(callFinishedSlot(QDBusPendingCallWatcher*)))
Note that it is not necessary to keep the original QDBusPendingCall
object around since QDBusPendingCallWatcher
inherits from that class too.
The slot connected to by the above code could be something similar to the following:
def callFinishedSlot(self, call): QByteArray> reply = call if (reply.isError()) { showError() else: text = reply.argumentAt<0>() data = reply.argumentAt<1>() showReply(text, data) call.deleteLater()
Note the use of QDBusPendingReply
to validate the argument types in the reply. If the reply did not contain exactly two arguments (one string and one QByteArray
), isError()
will return true.
See also
QDBusPendingReply
- class PySide6.QtDBus.QDBusPendingCallWatcher(call[, parent=None])¶
- Parameters
parent –
PySide6.QtCore.QObject
Creates a QDBusPendingCallWatcher
object to watch for replies on the asynchronous pending call call
and sets this object’s parent to parent
.
- PySide6.QtDBus.QDBusPendingCallWatcher.finished([self=None])¶
- Parameters
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.