PDA

View Full Version : Signal and slot connection graph



fahlen
27th November 2007, 08:41
Hi. I was wondering if there is any application out there which can take a Qt project file, scan the source files and draw the signal/slot connection graph. I'm looking for something in the lines of
qtobjectinspector (http://trolltech.com/products/qt/addon/solutions/catalog/3/Tools/qtobjectinspector/), but I'm really only interested in a static connection graph, i.e. sort of a class diagram showing the connections between signals and slots. It wouldn't take into account that signals and slots actually are connected between class instances and not classes.

I guess I'm just lazy, but for my current project it would help in getting and overview of the application.

Thanks

high_flyer
27th November 2007, 12:48
It wouldn't take into account that signals and slots actually are connected between class instances and not classes.

What do you mean "it wouldn't"?
Signals and slot ARE only between instances, not between classes.

fahlen
27th November 2007, 13:24
Exactly. Signals and slots are between instances. And I would like to autogenerate a "class diagram" displaying connections between signals and slots, _ignoring_ that very fact. If there is ever a connection made between an object of ClassA and an object of ClassB, then I want to show this connection in the diagram. Maybe to most, this doesn't seem like a very helpful feature, but to me it does. It would help me to get a _sketchy_ overview of the app, and I put ephasis on sketchy. Some apps are driven by signals triggering the execution of slots more than others, and sometimes it can be difficult to get a quick overview. But I take it from your answer that there isn't any such utility around, as such a diagram wouldn't be an entirely correct representation, so I won't keep looking.

high_flyer
27th November 2007, 13:32
But I take it from your answer that there isn't any such utility around, as such a diagram wouldn't be an entirely correct representation, so I won't keep looking.
Well, the fact I don't know any doesn't mean there are none. ;)
I would be surprised if you would find such an application through, since it make no sense to have this feature - except in in your view of your case.

wysota
27th November 2007, 13:47
It's possible to do such a graph using grep, sed or awk (or both) and graphviz. First grep your sources for connect statements and extract the data from them (sender, signal, receiver, slot), then grep sources again to find classes for each of the sender and receiver objects and then use graphviz to create a graph.