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]
12
class
MyObject
:
public
QObject
,
13
protected
QDBusContext
14
{
15
Q_OBJECT
16
17
QDBusConnection
conn
;
18
QDBusMessage msg;
19
20
//...
21
22
protected
slots
:
23
void
process
();
24
public
slots
:
25
void
methodWithError
();
26
QString
methodWithDelayedReply
();
27
};
28
29
void
MyObject
::methodWithError()
30
{
31
sendErrorReply(QDBusError::NotSupported,
32
"The method call 'methodWithError()' is not supported"
);
33
}
34
35
QString
MyObject
::
methodWithDelayedReply
()
36
{
37
conn = connection();
38
msg = message();
39
setDelayedReply(
true
);
40
QMetaObject::invokeMethod(
this
, &MyObject::process, Qt::QueuedConnection);
41
return
QString();
42
}
43
//! [0]
MyObject
[7]
Definition
src_corelib_kernel_qobject.cpp:96
MyObject::methodWithDelayedReply
QString methodWithDelayedReply()
Definition
src_qdbus_qdbuscontext.cpp:35
qtbase
src
dbus
doc
snippets
code
src_qdbus_qdbuscontext.cpp
Generated on Mon Mar 10 2025 00:40:46 for Qt by
1.13.2