Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Using QDBus without app.exec() or Event Loop - Is It Possible?

Using QDBus without app.exec() or Event Loop - Is It Possible?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 206 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lkimuka
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • L Offline
        L Offline
        lkimuka
        wrote on last edited by
        #3

        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 Reply Last reply
        0
        • L lkimuka has marked this topic as solved on

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved