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. How to get list of objects+slots connected to some object+signal?
Forum Updated to NodeBB v4.3 + New Features

How to get list of objects+slots connected to some object+signal?

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 6.8k 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.
  • Y Offline
    Y Offline
    yshurik
    wrote on last edited by
    #1

    I have some "transmitter" object and have a need to get list of all slots+objects connected to my signal in transmitter. How can it be done?

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      ZapB
      wrote on last edited by
      #2

      I think you would have to build a slightly modified version of Qt to do this. The connections list is maintained inside private QObjectData (iirc). So you would need to provide an accessor function for this data.

      Why do you need this information? Qt signals are supposed to provide loose coupling of components. i.e. an emitter shoudl not care about who is listening.

      Nokia Certified Qt Specialist
      Interested in hearing about Qt related work

      1 Reply Last reply
      0
      • Y Offline
        Y Offline
        yshurik
        wrote on last edited by
        #3

        I would like to install my "listener" in between. I can not change sources of objects on both sides so I would like to break connections, then restore connections with my "listener" in the middle.

        1 Reply Last reply
        0
        • Z Offline
          Z Offline
          ZapB
          wrote on last edited by
          #4

          Does the listener need to be in between or can it just listen along with the existing connected objects?

          Nokia Certified Qt Specialist
          Interested in hearing about Qt related work

          1 Reply Last reply
          0
          • Y Offline
            Y Offline
            yshurik
            wrote on last edited by
            #5

            Well, I would like to do some filtering and no deliver some signals

            1 Reply Last reply
            0
            • K Offline
              K Offline
              koahnig
              wrote on last edited by
              #6

              Do you do the connection between objects in your code or is it completely out of your hands?
              If you do it yourself, it would be easy to divert the signals to your code. So, you really want to break the signals.

              Vote the answer(s) that helped you to solve your issue(s)

              1 Reply Last reply
              0
              • Z Offline
                Z Offline
                ZapB
                wrote on last edited by
                #7

                Can you not just call disconnect() from outside of the object of which you do not have source control and reconnect them via your intermediary? Or is the problem that you do not know which connections to disconnect? If so then easiest way to find out is to build modified Qt to expose the info that you need because at present I do not think that QObject exposes this information in its public interface.

                Nokia Certified Qt Specialist
                Interested in hearing about Qt related work

                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