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. Qt+dbus: signals automatically connected and disconnected?
Forum Updated to NodeBB v4.3 + New Features

Qt+dbus: signals automatically connected and disconnected?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 3.2k Views 1 Watching
  • 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.
  • J Offline
    J Offline
    JamesBrown147
    wrote on last edited by
    #1

    Hi there!

    I want to use the dbus system qt comes with. As far as I've tested it, it works fine. Now I have one question:

    I used the qdbusxml2cpp tool to generate my code and I managed to send signals from my server application to the client. What I had to do was to something like this:

    @QObject::connect(myInterfaceObject, SIGNAL(someSignal()), this, SLOT(someSlot()));@

    There are the methods connect and disconnect in the QDBusConnection class which connects and disconnects signals and slots from the respective dbus service to a slot in my process. What I want to know: Is this connection and disconnection to the dbus signals done automatically with the QObject::connect/disconnect calls in my Object which receives the signals?

    It's interesting because of performance issues. Can I assume that my process does not receive signals from the dbus if there is no slot connected to it? Or do I receive these signals and qts dbus module discards them if no slot is connected? And are these signals automatically disconnected when the Object which wanted to receive them gets deleted? From the "D-Bus Tutorial":http://dbus.freedesktop.org/doc/dbus-tutorial.html#signalprocedure :

    bq. The emitter (aka sender) of a signal has no knowledge of the signal recipients. Recipients register with the bus daemon to receive signals based on "match rules" - these rules would typically include the sender and the signal name. The bus daemon sends each signal only to recipients who have expressed interest in that signal.

    I just want to make sure that my process does not receive any signals from the server when there is no slot registered to it.

    Thanks in advance.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      JamesBrown147
      wrote on last edited by
      #2

      I think I found the answer: The interface will connect signal to the dbus dynamically. I found

      @QDBusAbstractInterface::connectNotify@

      in the source of QDBusAbstractInterface which calls connection->connectRelay.

      If you investigate a little bit further you will find the calls to connection->connect(..) somewhere. Vice versa you can find the same stuff for the disconnectNotify.

      So in my opinion: Smart Qt :D

      1 Reply Last reply
      0

      • Login

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