I have a QGraphicsView and added a QGraphicsScene to it. On the QGraphicsScene I display my self-defined QGraphicsItem, it’s a triangulation of some points.
Now, I want to insert some edges into the triangulation by drawing them on the triangulation. Drawing means clicking from point to point, while dragging a line between the last point and my cursor position (I’m using a mouseMoveEvent
). These lines are as well QGraphicItems, and I set the Z value so that they are drawn above the triangulation.
While I’m drawing them, I don’t want the triangulation QGraphicsItem to repaint itself. But currently, on every mouseMoveEvent
, the whole triangulation is repainted.
I have read, that whenever some QGraphicsItem (the drawn line on my mouse cursor) on the QGraphicsScene is changed, the QGraphicsScene repaints all QGraphicsItems on it.
What can I use to prevent this redrawing of the triangulation? Maybe something like that I can add a new transparent widget on my QGraphicsView, that you can still see the triangulation and then drag the lines on the widget on top of the triangulation?