Using QDBus without app.exec() or Event Loop - Is It Possible?
-
wrote on 30 Oct 2024, 08:11 last edited by
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.
-
wrote on 1 Nov 2024, 02:02 last edited by
Hi SGaist,
Thank you very much for the guidance. I ended up switching my event loop to an asynchronous loop to better integrate with Qt.
-
1/3