⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)
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.