I have a QGraphicsItem (A) and I would like to implement a path tracing functionality for it. (ie as A changes position, a graphical trace is drawn on QGraphicsView).

I was thinking to create a custom QGraphicsItem (B) with a QPolygonF data member which will hold N points. Then in the paintEvent, use those points to draw N circles, one next the other thus creating the trace I want. My problem is a part of QGraphicsItem documentation which states the following:

"QGraphicsScene expects all items boundingRect() and shape() to remain unchanged unless it is notified. If you want to change an item's geometry in any way, you must first call prepareGeometryChange() to allow QGraphicsScene to update its bookkeeping.".

So calling prepareGeometryChange() in every paintEvent is not a solution.

Any suggestions on what should I do?

NOTE: I would prefer a solution where the tracer is a child of A.