Well, it's been a long time. This post will be dedicated to explanations on how to draw graphs in Qt's QGraphicsScene, using GraphViz. We're not talking about rendering an SVG graph with GraphViz and then printing it in a scene, however. What we will do, instead, is:
- represent a graph, using a C++ wrapper class for libgraph
- tell GraphViz to compute positions for each node, and the path of each edge
- draw our graph using QGraphicsEllipseItem and QGraphicsPathItem
The whole thing is used in a computer security research project on which I'm not allowed to give any information, so I will be vague on some parts of this tutorial, and I will not provide a whole bunch of ready-to-run code. I'm still going to give you the hints for fulfilling the three tasks above, and I will publish the class I wrote for my project (it is, of course, not generic at all, since it was designed for my particular needs).
This tutorial assumes you have a decent knowledge of how Graphviz works, and basic knowledge of the QGraphics API.






About
Blogroll
Latest articles
Package updates
Support Us
Steve Dodier-Lazaro's blog






