diff options
author | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2014-11-10 11:42:02 +0100 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2014-11-10 11:45:49 +0100 |
commit | 0d02a06517f29c5b51fb2d3ac64a5e6d9daed5a9 (patch) | |
tree | 3426504f004cbd2fffaceec24678bb16e9abfe37 /src/widgets/graphicsview | |
parent | d7a5dc0cfdae2fb22b7061301575f04f2bcc3f1c (diff) | |
parent | ba73bde66efa588a74eaaa946e80e9de2b9e2d59 (diff) |
Merge remote-tracking branch 'origin/5.4' into 5.4.0
Change-Id: I85e3dfa62f217b76447276dd7cce6b9eac3a144e
Diffstat (limited to 'src/widgets/graphicsview')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsitem.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 76a75dfc35..300e2f492b 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -1968,8 +1968,10 @@ QGraphicsItem::CacheMode QGraphicsItem::cacheMode() const Caching can speed up rendering if your item spends a significant time redrawing itself. In some cases the cache can also slow down rendering, in particular when the item spends less time redrawing than QGraphicsItem - spends redrawing from the cache. When enabled, the item's paint() function - will be called only once for each call to update(); for any subsequent + spends redrawing from the cache. + + When caching is enabled, an item's paint() function will generally draw into an + offscreen pixmap cache; for any subsequent repaint requests, the Graphics View framework will redraw from the cache. This approach works particularly well with QGLWidget, which stores all the cache as OpenGL textures. @@ -1980,6 +1982,12 @@ QGraphicsItem::CacheMode QGraphicsItem::cacheMode() const You can read more about the different cache modes in the CacheMode documentation. + \note Enabling caching does not imply that the item's paint() function will be + called only in response to an explicit update() call. For instance, under + memory pressure, Qt may decide to drop some of the cache information; + in such cases an item's paint() function will be called even if there + was no update() call (that is, exactly as if there were no caching enabled). + \sa CacheMode, QPixmapCache::setCacheLimit() */ void QGraphicsItem::setCacheMode(CacheMode mode, const QSize &logicalCacheSize) @@ -5337,6 +5345,16 @@ void QGraphicsItem::setBoundingRegionGranularity(qreal granularity) All painting is done in local coordinates. + \note It is mandatory that an item will always redraw itself in the exact + same way, unless update() was called; otherwise visual artifacts may + occur. In other words, two subsequent calls to paint() must always produce + the same output, unless update() was called between them. + + \note Enabling caching for an item does not guarantee that paint() + will be invoked only once by the Graphics View framework, + even without any explicit call to update(). See the documentation of + setCacheMode() for more details. + \sa setCacheMode(), QPen::width(), {Item Coordinates}, ItemUsesExtendedStyleOption */ |