Search code examples
c++qtduplicatessignals-slots

Is there a way to check duplicated connection in Qt?


If a

connect(sender,signal,receiver,slot); 

is called multiple times. When the signal is emit the slot will be called multiple times. I know UniqueConnection can be used to prevent this.

But is there a way to quickly check the potential duplicated connection? I am now looking into a project with thousands of lines of codes.


Solution

  • You can use Conan which is a connection analyzer for Qt. Using it you can see object hierarchies, object inheritance, signal/slot connections, and signal emissions at run time. It claims that :

    Conan has been used to identify multiple duplicate connections in the source code of Qt!

    An other option is to use GammaRay which is a perfect tool to analyze your Qt application in many aspects. Of course it has the ability of browsing object properties, signals, slots and connections.