summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp7
-rw-r--r--src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h1
-rw-r--r--src/gui/graphicsview/qgraphicssceneindex.cpp10
-rw-r--r--src/gui/graphicsview/qgraphicssceneindex.h2
5 files changed, 21 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 9b6d40b..479a548 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -1422,7 +1422,7 @@ QGraphicsScene::~QGraphicsScene()
QRectF QGraphicsScene::sceneRect() const
{
Q_D(const QGraphicsScene);
- return d->hasSceneRect ? d->sceneRect : d->growingItemsBoundingRect;
+ return d->index->indexedRect();
}
void QGraphicsScene::setSceneRect(const QRectF &rect)
{
diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp
index 1f2b81d..8a26447 100644
--- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp
+++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.cpp
@@ -61,6 +61,13 @@ QGraphicsSceneBspTreeIndex::QGraphicsSceneBspTreeIndex(QGraphicsScene *scene)
}
+
+QRectF QGraphicsSceneBspTreeIndex::indexedRect()
+{
+ _q_updateIndex();
+ return scene()->d_func()->hasSceneRect ? scene()->d_func()->sceneRect : scene()->d_func()->growingItemsBoundingRect;
+}
+
void QGraphicsSceneBspTreeIndex::clear()
{
bsp.clear();
diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h
index 63cd0e1..7a6ea0b 100644
--- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h
+++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h
@@ -61,6 +61,7 @@ class Q_AUTOTEST_EXPORT QGraphicsSceneBspTreeIndex : public QGraphicsSceneIndex
Q_OBJECT
public:
QGraphicsSceneBspTreeIndex(QGraphicsScene *scene = 0);
+ QRectF indexedRect();
void clear();
diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp
index 36da295..fe3a68a 100644
--- a/src/gui/graphicsview/qgraphicssceneindex.cpp
+++ b/src/gui/graphicsview/qgraphicssceneindex.cpp
@@ -297,6 +297,16 @@ QGraphicsScene* QGraphicsSceneIndex::scene() const
Q_D(const QGraphicsSceneIndex);
return d->scene;
}
+
+/*!
+ Returns the indexed area for the index
+*/
+QRectF QGraphicsSceneIndex::indexedRect()
+{
+ Q_D(const QGraphicsSceneIndex);
+ return d->scene->d_func()->sceneRect;
+}
+
/*!
\fn QList<QGraphicsItem *> items() const = 0
diff --git a/src/gui/graphicsview/qgraphicssceneindex.h b/src/gui/graphicsview/qgraphicssceneindex.h
index da3096e..11d9aae 100644
--- a/src/gui/graphicsview/qgraphicssceneindex.h
+++ b/src/gui/graphicsview/qgraphicssceneindex.h
@@ -71,6 +71,8 @@ public:
QGraphicsScene *scene() const;
+ virtual QRectF indexedRect();
+
virtual QList<QGraphicsItem *> items() const = 0;
virtual QList<QGraphicsItem *> items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const;
virtual QList<QGraphicsItem *> items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const;