Using QDBus without app.exec() or Event Loop - Is It Possible?
-
I’m using QDBus to register and send DBus messages but want to avoid using app.exec() or a full Qt event loop. The goal is to handle DBus messages with minimal Qt dependencies—no threads, timers, or additional Qt features.
Is there a way to receive and handle DBus messages with QDBus without relying on app.exec() or a Qt event loop? Or is an event loop required for QDBus to function correctly?
P.S. My program includes own event loop, so it doesn’t exit immediately.
-
Hi and welcome to devnet,
AFAIK, yes you need an event loop running for QDBus to work properly.
However, depending on how you implemented the rest of your application, you should be able to manually trigger the event handling of Qt from within your own event loop. Beware, that may have unexpected side effects.
-