I'm building an editor (similar to MS Visio) to draw a hierarchical finite state machine. Hence I need to draw rectangles (states) and lines (transitions) in a QGraphicView.

How to programmatically print the content of a QGraphicView?