Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
src_qdbus_qdbuspendingreply.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3#include <QDBusPendingCall>
4#include <QDBusInterface>
5#include <QDBusPendingReply>
6
8{
10
11public:
13 : QObject(parent) {
14 iface = new QDBusInterface("org.example.Interface", "/Example/Methods");
15 }
16
24 void useValue(QDBusPendingReplyTypes::Select<0, QString, void, void, void, void, void, void, void>::Type);
25public slots:
26
27private:
29};
30
32{
33//! [0]
34 QDBusPendingReply<QString> reply = iface->asyncCall("RemoteMethod");
35 reply.waitForFinished();
36 if (reply.isError())
37 // call failed. Show an error condition.
38 showErrorD(reply.error());
39 else
40 // use the returned value
41 useValue(reply.value());
42//! [0]
43}
44
46{
47//! [2]
48 QDBusPendingReply<bool, QString> reply = iface->asyncCall("RemoteMethod");
49 reply.waitForFinished();
50 if (!reply.isError()) {
51 if (reply.argumentAt<0>())
52 showSuccess(reply.argumentAt<1>());
53 else
54 showFailure(reply.argumentAt<1>());
55 }
56//! [2]
57}
void showErrorD(QDBusError)
void useValue(QDBusPendingReplyTypes::Select< 0, QString, void, void, void, void, void, void, void >::Type)