I'm making a Diagram (Fluxogram) program and for days I'm stuck with this issue:
I have a custom QGraphicsScene
that expands horizontally whenever I place an item to it's rightmost area. The problem is that my custom arrows (they inherit QGraphicsPathItem
) disappear from the scene whenever it's boundingRect()
center is scrolled off the view. Everytime the scene expands, both it's sceneRect()
and the view's sceneRect()
are updated as well.
I've:
set ui->graphicsView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate)
the item flags QGraphicsItem::ItemIgnoresTransformations
and QGraphicsItem::ItemSendsGeometryChanges
, setActive(true)
on the item as well, and everytime I add an arrow to the scene i call the update(sceneRect())
method. Still, everytime I scroll the view, as soon as the arrow's boundingRect()
center moves away from the view, all the arrow disappears. If I scroll back and the boundingRect() center enters the view, all the arrow appears again.
Can someone give me a tip of what I might be missing? I've been using Qt's example project diagramscene as reference, so a lot of my code is similar (the "press item toolButton -> click on the scene" relation to insert items, the way they place the arrows to connect the objects,...).
In the meanwhile I'll try to make a minimal running example that can show what my issue is.