Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QGraphicsView drawForeground affecting pixmap items
Qt 6.11 is out! See what's new in the release blog

QGraphicsView drawForeground affecting pixmap items

Scheduled Pinned Locked Moved Solved General and Desktop
qgraphicsview
2 Posts 1 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kegon
    wrote on last edited by kegon
    #1

    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.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kegon
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved