How to get list of objects+slots connected to some object+signal?
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?
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.
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.