diff options
Diffstat (limited to 'doc/src/snippets/code/src.qdbus.qdbuspendingreply.cpp')
-rw-r--r-- | doc/src/snippets/code/src.qdbus.qdbuspendingreply.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/src/snippets/code/src.qdbus.qdbuspendingreply.cpp b/doc/src/snippets/code/src.qdbus.qdbuspendingreply.cpp new file mode 100644 index 0000000..49363a8 --- /dev/null +++ b/doc/src/snippets/code/src.qdbus.qdbuspendingreply.cpp @@ -0,0 +1,23 @@ +{ +//! [0] + QDBusPendingReply<QString> reply = interface->asyncCall("RemoteMethod"); + reply.waitForFinished(); + if (reply.isError()) + // call failed. Show an error condition. + showError(reply.error()); + else + // use the returned value + useValue(reply.value()); +//! [0] + +//! [2] + QDBusPendingReply<bool, QString> reply = interface->asyncCall("RemoteMethod"); + reply.waitForFinished(); + if (!reply.isError()) { + if (reply.argumentAt<0>()) + showSuccess(reply.argumentAt<1>()); + else + showFailure(reply.argumentAt<1>()); + } +//! [2] +} |