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, can't stop system caching pixmaps
QtWS25 Last Chance

QGraphicsView, can't stop system caching pixmaps

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.5k 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.
  • D Offline
    D Offline
    dakster
    wrote on last edited by
    #1

    I have a QT app that has a 2-D map interface that draws icons over the map. A new feature request is that the icons alone can be viewed without the map background.

    The maps are broken into tiles on the filesystem, and are loaded/unloaded from memory in a separate thread (as QImages). The GUI process itself has an update that takes these QImages when they've been read from disc, then loads them as QGraphicsPixmapItems (within the GUI process).

    This is a small demo app, nothing commercial. There are three different map layers, topographics maps, FAA charts, and OpenStreetMaps. Switching between all of these works fine, and has for a long time.

    I have a simple button in my GUI to turn off the map layer under the icons, but no matter how I try to get this working, I can't make the map images go away completely.

    The QGraphicsPixmapItems that are the map tiles are grouped together into a QGraphicsItemGroup. I've tried setting visibility of this group to false, I've tried individually setting the pixmap items to not be visible, removing the pixmaps from the graphicsview, removing the pixmap group from the graphicsview, unloading the pixmaps from memory, all with the same results

    When any of these methods are attempted the map stops updating itself, as in I can drag the map interface around, and the map tiles no long move with the geo referenced icons (mouse drag), however it seems the map tiles are still being drawn from some kind of cache. I also get odd rendering issues for the icons/elements that are still "active" (see pics in link)

    "Imgur link to two pics, normal and with the map supposedly disabled, while dragging the display around":http://imgur.com/a/ok3sJ

    This seems like a cache issue to me, so I've tried the following in various incarnations along with the setVisible(false) on the items/item group, removing items from scene, and unloading tiles from memory:
    QGraphicsItemGroup setCacheMode(QGraphicsItem::NoCache)
    QGraphicsView setCacheMode(QGraphicsView::CacheNone)
    QGraphicsView invalidateScene()
    QGraphicsView resetCachedContent()
    QGraphicsItemGroup update()
    QGraphicsView update()
    QGraphicsView setViewportUpdateModel(QGraphicsView::FullViewportUpdate);

    I'm really at a loss as to what to try next. I've verified that I see this problem in both Nvidia systems with the Nvidia proprietary Linux driver, and on an ATI based gpu, running the ATI proprietary Linux driver.

    Any tips out there? I'm obviously no guru on QGraphicsViews.

    The QGraphicsView viewport is set to a QGLWidget. The "scene" is set to a QGraphicsScene. I'm thinking this has to be a cache issue. When I start the program up, the first flash of the map shows whatever the display was last time I ran the app, so it definitely seems like the system is caching the pixmaps, even though I'm telling the software not to.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dakster
      wrote on last edited by
      #2

      Quick update. I've got it down to using a QGLWidget as the viewport for the graphicsview. If I stop setting the viewport to a QGLWidget, this problem doesn't occur.

      A bit of a slowdown in my map app, but I can probably live with it until I can figure out why I'm getting odd results with the QGLWidget.

      Anyone with tips, I'm all ears. Thanks in advance.

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jack.yan
        wrote on last edited by
        #3

        @dakster said in QGraphicsView, can't stop system caching pixmaps:

        //imgur.com/a/ok3sJ

        i got same problem , any idea?

        JKSHJ 1 Reply Last reply
        0
        • J jack.yan

          @dakster said in QGraphicsView, can't stop system caching pixmaps:

          //imgur.com/a/ok3sJ

          i got same problem , any idea?

          JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by
          #4

          Hi, and welcome!

          @jack-yan said in QGraphicsView, can't stop system caching pixmaps:

          @dakster said in QGraphicsView, can't stop system caching pixmaps:

          //imgur.com/a/ok3sJ

          i got same problem , any idea?

          @dakster resolved the issue by removing QGLWidget. Have you tried the same?

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          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