Last change
on this file since 5 was 2, checked in by Dmitry A. Kuminov, 16 years ago |
Initially imported qt-all-opensource-src-4.5.1 from Trolltech.
|
File size:
648 bytes
|
Line | |
---|
1 | //! [0]
|
---|
2 | class MyObject: public QObject,
|
---|
3 | protected QDBusContext
|
---|
4 | {
|
---|
5 | Q_OBJECT
|
---|
6 | QDBusConnection conn;
|
---|
7 | QDBusMessage msg;
|
---|
8 |
|
---|
9 | ...
|
---|
10 |
|
---|
11 | protected slots:
|
---|
12 | void process();
|
---|
13 | public slots:
|
---|
14 | void methodWithError();
|
---|
15 | QString methodWithDelayedReply();
|
---|
16 | };
|
---|
17 |
|
---|
18 | void MyObject::methodWithError()
|
---|
19 | {
|
---|
20 | sendErrorReply(QDBusError::NotSupported,
|
---|
21 | "The method call 'methodWithError()' is not supported");
|
---|
22 | }
|
---|
23 |
|
---|
24 | QString MyObject::methodWithDelayedReply()
|
---|
25 | {
|
---|
26 | conn = connection();
|
---|
27 | msg = message();
|
---|
28 | setDelayedReply(true);
|
---|
29 | QMetaObject::invokeMethod(this, "process", Qt::QueuedConnection);
|
---|
30 | return QString();
|
---|
31 | }
|
---|
32 | //! [0]
|
---|
Note:
See
TracBrowser
for help on using the repository browser.