Home · All Classes · Modules |
The QDBusServiceWatcher class allows the user to watch for a bus service change. More...
Inherits QObject.
The QDBusServiceWatcher class allows the user to watch for a bus service change.
A QDBusServiceWatcher object can be used to notify the application about an ownership change of a service name on the bus. It has three watch modes:
Besides being created or deleted, services may change owners without a unregister/register operation happening. So the serviceRegistered() and serviceUnregistered() signals may not be emitted if that happens.
This class is more efficient than using the QDBusConnectionInterface.serviceOwnerChanged() signal because it allows one to receive only the signals for which the class is interested in.
QDBusServiceWatcher supports three different watch modes, which are configured by this flag:
Constant | Value | Description |
---|---|---|
QDBusServiceWatcher.WatchForRegistration | 0x01 | watch for service registration only, ignoring any signals related to other service ownership change. |
QDBusServiceWatcher.WatchForUnregistration | 0x02 | watch for service unregistration only, ignoring any signals related to other service ownership change. |
QDBusServiceWatcher.WatchForOwnerChange | 0x03 | watch for any kind of service ownership change. |
The WatchMode type is a typedef for QFlags<WatchModeFlag>. It stores an OR combination of WatchModeFlag values.
The parent argument, if not None, causes self to be owned by Qt instead of PyQt.
Creates a QDBusServiceWatcher object. Note that until you set a connection with setConnection(), this object will not emit any signals.
The parent parameter is passed to QObject to set the parent of this object.
The parent argument, if not None, causes self to be owned by Qt instead of PyQt.
Creates a QDBusServiceWatcher object and attaches it to the connection connection. Also, this function immediately starts watching for watchMode changes to service service.
The parent parameter is passed to QObject to set the parent of this object.
Adds newService to the list of services to be watched by this object. This function is more efficient than setWatchedServices() and should be used whenever possible to add services.
Returns the QDBusConnection that this object is attached to.
See also setConnection().
Removes the service from the list of services being watched by this object. Note that D-Bus notifications are asynchronous, so there may still be signals pending delivery about service. Those signals will still be emitted whenever the D-Bus messages are processed.
This function returns true if any services were removed.
Sets the D-Bus connection that this object is attached to be connection. All services watched will be transferred to this connection.
Note that QDBusConnection objects are reference counted: QDBusServiceWatcher will keep a reference for this connection while it exists. The connection is not closed until the reference count drops to zero, so this will ensure that any notifications are received while this QDBusServiceWatcher object exists.
See also connection().
This is the default overload of this signal.
This signal is emitted whenever this object detects that there was a service ownership change relating to the serviceName service. The oldOwner parameter contains the old owner name and newOwner is the new owner. Both oldOwner and newOwner are unique connection names.
Note that this signal is also emitted whenever the serviceName service was registered or unregistered. If it was registered, oldOwner will contain an empty string, whereas if it was unregistered, newOwner will contain an empty string.
If you need only to find out if the service is registered or unregistered only, without being notified that the ownership changed, consider using the specific modes for those operations. This class is more efficient if you use the more specific modes.
See also serviceRegistered() and serviceUnregistered().
This is the default overload of this signal.
This signal is emitted whenever this object detects that the service serviceName became available on the bus.
See also serviceUnregistered() and serviceOwnerChanged().
This is the default overload of this signal.
This signal is emitted whenever this object detects that the service serviceName was unregistered from the bus and is no longer available.
See also serviceRegistered() and serviceOwnerChanged().
PyQt 4.9.4 for Windows | Copyright © Riverbank Computing Ltd and Nokia 2012 | Qt 4.8.2 |