2
votes

I have a QGraphicsView and a QGraphicsScene set up without any properties changed but

view->setDragMode(QGraphicsView::RubberBandDrag);
view->setRenderHint(QPainter::Antialiasing, true);

When dragging arround for a bit the RubberBandDrag leaves artifacts and the RubberBand itself is often rendered incorrectly, missing the sides:

QGraphicsScene RubberBandDrag Artifacts

Also other graphics items such as a regular QGraphicsRectItem leave these traces. I tried without the antialias but that seems to make it even worse.

Do I have to set specific properties of the view/scene such as disabling optimization flags?

Or is this just a bug of Qt? (I am using 5.9.2) At least I couldn't find a report of this.

1

1 Answers

2
votes

I had similar problem. After I play around these two calls, things got fixed.

QGraphicsView.setCacheMode(QGraphicsView::CacheBackground);

QGraphicsView.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);