summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/src_qdbus_qdbusabstractinterface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/snippets/code/src_qdbus_qdbusabstractinterface.cpp')
-rw-r--r--doc/src/snippets/code/src_qdbus_qdbusabstractinterface.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/src/snippets/code/src_qdbus_qdbusabstractinterface.cpp b/doc/src/snippets/code/src_qdbus_qdbusabstractinterface.cpp
new file mode 100644
index 0000000..cc5b86d
--- /dev/null
+++ b/doc/src/snippets/code/src_qdbus_qdbusabstractinterface.cpp
@@ -0,0 +1,20 @@
+//! [0]
+QString value = retrieveValue();
+QDBusMessage reply;
+
+QDBusReply<int> api = interface->call(QLatin1String("GetAPIVersion"));
+if (api >= 14)
+ reply = interface->call(QLatin1String("ProcessWorkUnicode"), value);
+else
+ reply = interface->call(QLatin1String("ProcessWork"), QLatin1String("UTF-8"), value.toUtf8());
+//! [0]
+
+//! [1]
+QString value = retrieveValue();
+QDBusPendingCall pcall = interface->asyncCall(QLatin1String("Process"), value);
+
+QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pcall, this);
+
+QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ this, SLOT(callFinishedSlot(QDBusPendingCallWatcher*)));
+//! [1]