Hi,
I'm working on a QGraphicsScene application in Qt 5,12. In my scene, I have static and dynamic elements. I have two lists of texts on the two side of my screen, as sources and targets. In between them, I have dynamic circle elements which make a trajectory between the source and the target based on the time.
My text item is a QGraphicsWidget in order to be able to stock them in a layout. I overrode the paint function of the QGraphicsWidget in which I call QGraphicsWidget:aint and I also draw a text using QPainter::drawText.
My circle item inherits from QGraphicsEllipseItem and it has two pointers to its source and destination.
By using a QTimer I update the position of my dynamic items so that they are moving from the source to the target.
My problem is that slowly my texts become erased as the circles pass. Please look at the attached screenshot.
I found a workaround to solve this problem by calling update on all of my text item when the timer times out.
Another solution I found is to subclass QgraphicsLayoutItem instead of subclassing the QGraphicsWidget.
Could you please someone explain me why in the first case my texts become erased?
Thanks
Bookmarks