PDA

View Full Version : Debugging singal-slot connections



gnik
11th July 2009, 20:50
When working on a large Qt software project the amount of signal-slot connections can really go through the roof. During run-time I often want to know what is connected to what. I also regularly want to know how often and when a specific signal is emitted. In general I just want some proper signal-slot debugging.
Unfortunately, Qt provides next to nothing for this. Sure you've got QObject::dumpObjectInfo, QObject::dumpObjectTree and the QSignalSpy, but their use is very limited and unpractical. So I decided to make my own signal-slot debugging library called Conan.

Conan is a C++ library that provides run-time introspection of QObject hierarchies, QObject inheritance, signal/slot connections, and signal emissions. Through use of the conan::ConanWidget:
-object hierarchies can be added/found and browsed
-signals/slots, including active connections, can be examined
-duplicate connections can be found
-signal emissions can be monitored and logged
Conan uses private Qt headers to extract all signal-slot information that exists.

I usually add the ConanWidget to my debug build, so I can use it whenever I need to. It is real easy to use and has helped me locate multiple duplicate signal connection in Qt's own libraries. So if you ever need some signal-slot introspection, try Conan.

Conan is GPL and can be downloaded from http://sourceforge.net/projects/conanforqt. There's a source package containing all sources, visual studio 2008 / qt creator / qmake project files, and extensive documentation. A demo application for Windows XP/Vista is also available, so you can play around with Conan and try it out first.

I hope you find it usefull.