summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/src.qdbus.qdbuspendingcall.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/snippets/code/src.qdbus.qdbuspendingcall.cpp')
-rw-r--r--doc/src/snippets/code/src.qdbus.qdbuspendingcall.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/src/snippets/code/src.qdbus.qdbuspendingcall.cpp b/doc/src/snippets/code/src.qdbus.qdbuspendingcall.cpp
new file mode 100644
index 0000000..c9b3b7c
--- /dev/null
+++ b/doc/src/snippets/code/src.qdbus.qdbuspendingcall.cpp
@@ -0,0 +1,24 @@
+{
+//! [0]
+ QDBusPendingCall async = iface->asyncCall("RemoteMethod", value1, value2);
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(async, this);
+
+ QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ this, SLOT(callFinishedSlot(QDBusPendingCallWatcher*)));
+//! [0]
+
+}
+
+//! [1]
+void MyClass::callFinishedSlot(QDBusPendingCallWatcher *call)
+{
+ QDBusPendingReply<QString, QByteArray> reply = *call;
+ if (reply.isError()) {
+ showError();
+ } else {
+ QString text = reply.argumentAt<0>();
+ QByteArray data = reply.argumentAt<1>();
+ showReply(text, data);
+ }
+}
+//! [1]