diff options
author | Dimitar Asenov <dimitar.asenov@gmail.com> | 2014-03-12 14:19:04 -0700 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-18 19:29:16 +0100 |
commit | 9891c5051f02b940f6dc94ac4ccf945e036feb13 (patch) | |
tree | 194e1a915407722796f88d952d79cec9dc2b9ebe /src/widgets/graphicsview/qgraphicsscene.h | |
parent | 4d09a54b7559f32d4824613f90f4016e9446fbd7 (diff) |
Add a new optimization property to QGraphicsScene
The minimumRenderSize is a qreal value that is used as a lower bound to
determine what items are visible when a scene is rendered. If an item's
view-transformed width or height are less than minimumRenderSize then
this item is considered to insignificantly affect the final result and
is not drawn. If the item clips its children to its shape they are
automatically not drawn. This greatly reduces the drawing overhead
for scenes with many items rendered in a zoomed out view.
[ChangeLog][QtWidgets][QGraphicsScene] Added the minimumRenderSize
property which can be used to speed up rendering by not painting
items, smaller than a give size.
Change-Id: Ie208234707dffb4d2fc620fc5d1514e0c144d9a8
Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
Diffstat (limited to 'src/widgets/graphicsview/qgraphicsscene.h')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsscene.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/widgets/graphicsview/qgraphicsscene.h b/src/widgets/graphicsview/qgraphicsscene.h index cde0eda125..ba47d45d63 100644 --- a/src/widgets/graphicsview/qgraphicsscene.h +++ b/src/widgets/graphicsview/qgraphicsscene.h @@ -107,6 +107,7 @@ class Q_WIDGETS_EXPORT QGraphicsScene : public QObject Q_PROPERTY(QFont font READ font WRITE setFont) Q_PROPERTY(bool sortCacheEnabled READ isSortCacheEnabled WRITE setSortCacheEnabled) Q_PROPERTY(bool stickyFocus READ stickyFocus WRITE setStickyFocus) + Q_PROPERTY(qreal minimumRenderSize READ minimumRenderSize WRITE setMinimumRenderSize) public: enum ItemIndexMethod { @@ -249,6 +250,9 @@ public: bool sendEvent(QGraphicsItem *item, QEvent *event); + qreal minimumRenderSize() const; + void setMinimumRenderSize(qreal minSize); + public Q_SLOTS: void update(const QRectF &rect = QRectF()); void invalidate(const QRectF &rect = QRectF(), SceneLayers layers = AllLayers); |