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_qdbuscontext.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
4#include <QString>
5#include <QDBusConnection>
6#include <QDBusArgument>
7#include <QDBusMetaType>
8#include <QDBusMessage>
9#include <QDBusContext>
10
11//! [0]
12class MyObject: public QObject,
13 protected QDBusContext
14{
15 Q_OBJECT
16
17 QDBusConnection conn;
18 QDBusMessage msg;
19
20 //...
21
22protected slots:
23 void process();
24public slots:
27};
28
29void MyObject::methodWithError()
30{
31 sendErrorReply(QDBusError::NotSupported,
32 "The method call 'methodWithError()' is not supported");
33}
34
36{
37 conn = connection();
38 msg = message();
39 setDelayedReply(true);
40 QMetaObject::invokeMethod(this, &MyObject::process, Qt::QueuedConnection);
41 return QString();
42}
43//! [0]
QString methodWithDelayedReply()