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
qdbusservicewatcher.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QDBUSSERVICEWATCHER_H
5#define QDBUSSERVICEWATCHER_H
6
7#include <QtCore/QObject>
8#include <QtCore/qcontainerfwd.h> // Q(String)List
9#include <QtDBus/qtdbusglobal.h>
10
11#if !defined(QT_NO_DBUS) && !defined(QT_NO_QOBJECT)
12
14
15class QString;
16template<typename T>
17class QBindable;
18
19class QDBusConnection;
20
22class Q_DBUS_EXPORT QDBusServiceWatcher: public QObject
23{
25 Q_PROPERTY(QStringList watchedServices READ watchedServices WRITE setWatchedServices
26 BINDABLE bindableWatchedServices)
27 Q_PROPERTY(WatchMode watchMode READ watchMode WRITE setWatchMode BINDABLE bindableWatchMode)
28public:
30 WatchForRegistration = 0x01,
31 WatchForUnregistration = 0x02,
32 WatchForOwnerChange = 0x03
33 };
34 Q_DECLARE_FLAGS(WatchMode, WatchModeFlag)
35 Q_FLAG(WatchMode)
36
37 explicit QDBusServiceWatcher(QObject *parent = nullptr);
39 WatchMode watchMode = WatchForOwnerChange, QObject *parent = nullptr);
41
42 QStringList watchedServices() const;
43 void setWatchedServices(const QStringList &services);
44 void addWatchedService(const QString &newService);
45 bool removeWatchedService(const QString &service);
46 QBindable<QStringList> bindableWatchedServices();
47
48 WatchMode watchMode() const;
49 void setWatchMode(WatchMode mode);
50 QBindable<WatchMode> bindableWatchMode();
51
53 void setConnection(const QDBusConnection &connection);
54
56 void serviceRegistered(const QString &service);
57 void serviceUnregistered(const QString &service);
58 void serviceOwnerChanged(const QString &service, const QString &oldOwner, const QString &newOwner);
59
60private:
61 Q_PRIVATE_SLOT(d_func(), void _q_serviceOwnerChanged(QString,QString,QString))
62 Q_DISABLE_COPY(QDBusServiceWatcher)
63 Q_DECLARE_PRIVATE(QDBusServiceWatcher)
64};
65
66Q_DECLARE_OPERATORS_FOR_FLAGS(QDBusServiceWatcher::WatchMode)
67
69
70#endif // QT_NO_DBUS || QT_NO_QOBJECT
71#endif // QDBUSSERVICEWATCHER_H
std::vector< ObjCStrongReference< CBMutableService > > services
\inmodule QtCore
Definition qproperty.h:811
\inmodule QtDBus
The QDBusServiceWatcher class allows the user to watch for a bus service change.
void serviceOwnerChanged(const QString &service, const QString &oldOwner, const QString &newOwner)
This signal is emitted whenever this object detects that there was a service ownership change relatin...
WatchModeFlag
QDBusServiceWatcher supports three different watch modes, which are configured by this flag:
void serviceUnregistered(const QString &service)
This signal is emitted whenever this object detects that the service serviceName was unregistered fro...
void serviceRegistered(const QString &service)
This signal is emitted whenever this object detects that the service serviceName became available on ...
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
DBusConnection * connection
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
GLenum mode
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_FLAG(x)
#define Q_PRIVATE_SLOT(d, signature)
#define Q_SIGNALS