Qt World Summit: Submit your Presentation

Purge Cache of QGraphicsItem

  • When using QGraphicsItem's cacheMode "DeviceCoordinateCache", I get some painting issues in a very specific case (combining of painting via QGraphicsView and QGraphicsScene::render).

    A simple solution would be to purge the cache of all items within the scene just before calling QGraphicsScene::render.
    I found an internal QGraphicsItemCache::purge(), but no way to invoke it from outside.
    One way to invoke it indirectly is to remember the cache mode, set it to NoCache, and set it back to the original cache mode. My headache for this is how to obtain the logicalCacheSize for those items with ItemCoordinateCache, so I can restore the original size.

    Any suggestions?

Log in to reply