QDBus interface watch - g_bus_watch_name

532 views Asked by At

Does Qt expose a method to watch a DBus interface, similar with g_bus_watch_name? I want to know when an application is started or closed, watching its DBus interface.

1

There are 1 answers

0
Linville On

There is the QDBusServiceWatcher class that can monitor the bus for service changes. From the docs-

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:

  • Watching for service registration only.
  • Watching for service unregistration only.
  • Watching for any kind of service ownership change (the default mode).