Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
None
-
4.8.6
-
None
-
CentOS 6.3, Qt 4.8.6
Description
I am maintaining an application using Qt 4.8.6. A QGraphicsView displays QGraphicsObjects. The paint method of the QGraphicsObjects calls QPainter::drawText. The application uses "indirect painting" (QGraphicsView has IndirectPainting flag). A timer of 100ms calls update on the viewport of the QGraphicsView. The main thread (which does the painting) also updates QGraphicsObjects by calling setPos upon receiving data from another thread, which means setPos is called in bewteen the updates.
The problem is that when setPos is called, a small part of the QGraphicsObjects (close the position) is drawn at the new position but the rest keeps being drawn at the previous position. At the end of the 100ms interval, all the QGraphicsObjects are drawn at their new positions. It is hardly visible but it can be disturbing for the application users.
When I increase the timer interval from 100ms to 1s, i can see the phenomenom more clearly. The boundingRect method of the QGraphicsObjects is defined properly so even if setPos triggers a repaint the QGraphicsObjects should be at least painted entirely.
I read the source code of QGraphicsItem::setPos. In setPosHelper, signals xchanged and ychanged are emitted which is probably what tiggers the partial painting.
Is the painting tiggered by setPos a bug ? Is there a way to prevent setPos from triggering a paint ?