Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QGraphicsView drawForeground affecting pixmap items
kegon last edited by kegon
I have a QGraphicsView with a QGraphicsScene and a single QPixmapItem displayed in the scene/view.
I want to put some extra information layered on top so I use
drawForeground()to place some text in a rectangle as a kind of on screen display.
The issue I have is that there appears to be an additional rectangle drawn near the pixmap using the same brush and pen I used before. When I manipulate the scale and location of the pixmap item, the extra rectangle is drawn again in the new position/scale, The foreground image "buffer" gets full of extraneous rectangles. A resize event clears the foreground buffer and gets rid of all the extraneous rectangles except the additional one on the pixmap.
Am I supposed to be clearing the foreground buffer ?
Occurs on Mac and Linux.
kegon last edited by
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);seems to solve it.