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
doc_src_qdbusadaptors.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 <QString>
4#include <QDBusMessage>
5#include <QDBusConnection>
6
7struct RequestData;
8void appendRequest(RequestData *) {}; // stub
9
10//! [10]
17
18QString processRequest(const QString &request, const QDBusMessage &message)
19{
20 RequestData *data = new RequestData;
21 data->request = request;
22 message.setDelayedReply(true);
23 data->reply = message.createReply();
24
26 return QString();
27}
28//! [10]
29
30
31//! [11]
33{
34 // data->processedData has been initialized with the request's reply
35 QDBusMessage &reply = data->reply;
36
37 // send the reply over D-Bus:
38 reply << data->processedData;
39 QDBusConnection::sessionBus().send(reply);
40
41 // dispose of the transaction data
42 delete data;
43}
44//! [11]
45
46
47//! [12]
49//! [12]
void sendReply(RequestData *data)
[10]
Q_NOREPLY void myMethod()
[11]
QString processRequest(const QString &request, const QDBusMessage &message)
void appendRequest(RequestData *)