QGraphicsView drawForeground affecting pixmap items



  • Hi,

    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.



  • Adding setViewportUpdateMode(QGraphicsView::FullViewportUpdate); seems to solve it.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.