Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
src_qdbus_qdbuspendingcall.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
17 ~DBus_PendingCall_Interface() { delete iface; }
18 void callInterfaceMain();
19 void showError();
24public slots:
25
26private:
27 QDBusInterface *iface;
28};
29
41
44{
45 QDBusPendingReply<QString, QByteArray> reply = *call;
46 if (reply.isError()) {
47 showError();
48 } else {
49 QString text = reply.argumentAt<0>();
50 QByteArray data = reply.argumentAt<1>();
52 }
53 call->deleteLater();
54}
DBus_PendingCall_Interface(QObject *parent=nullptr)
void callFinishedSlot(QDBusPendingCallWatcher *call)
[1]
void showReply(QString &, QByteArray &)
\inmodule QtCore
Definition qbytearray.h:57
QDBusPendingCall asyncCall(const QString &method)
\inmodule QtDBus
void finished(QDBusPendingCallWatcher *self=nullptr)
This signal is emitted when the pending call has finished and its reply is available.
\inmodule QtDBus
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2960
void deleteLater()
\threadsafe
Definition qobject.cpp:2435
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
QString text
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
#define Q_OBJECT
#define slots
QFutureWatcher< int > watcher
QNetworkReply * reply