summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-06-30 14:15:28 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-06-30 14:15:28 (GMT)
commit3a00930fe167e6db5588d9e93d429486f9591bd1 (patch)
tree2da7686fabb538876c783a816042e633a323a491 /src/gui
parent99bea47fd9b868fb22f175943c11ecb05b51f07c (diff)
downloadQt-3a00930fe167e6db5588d9e93d429486f9591bd1.zip
Qt-3a00930fe167e6db5588d9e93d429486f9591bd1.tar.gz
Qt-3a00930fe167e6db5588d9e93d429486f9591bd1.tar.bz2
More BSP tree index cleanup.
Ensure the index of indexed items are reset to -1. Makes tst_QGraphicsScene::itemIndexMethod happy. (this test passed before we actually started using the BSP from the items() functions, see 6ee3fb750377eeedf161d96fef02c5fa336810e9)
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp12
-rw-r--r--src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp
index 413c8de..ff9a3da 100644
--- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp
+++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp
@@ -468,6 +468,18 @@ QGraphicsSceneBspTreeIndex::QGraphicsSceneBspTreeIndex(QGraphicsScene *scene)
}
+QGraphicsSceneBspTreeIndex::~QGraphicsSceneBspTreeIndex()
+{
+ Q_D(QGraphicsSceneBspTreeIndex);
+ for (int i = 0; i < d->indexedItems.size(); ++i) {
+ // Ensure item bits are reset properly.
+ if (QGraphicsItem *item = d->indexedItems.at(i)) {
+ Q_ASSERT(!item->d_ptr->itemDiscovered);
+ item->d_ptr->index = -1;
+ }
+ }
+}
+
/*!
\reimp
Clear the all the BSP index.
diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h
index 90cc8c3..7b431e6 100644
--- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h
+++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h
@@ -80,6 +80,7 @@ class Q_AUTOTEST_EXPORT QGraphicsSceneBspTreeIndex : public QGraphicsSceneIndex
Q_PROPERTY(int bspTreeDepth READ bspTreeDepth WRITE setBspTreeDepth)
public:
QGraphicsSceneBspTreeIndex(QGraphicsScene *scene = 0);
+ ~QGraphicsSceneBspTreeIndex();
QList<QGraphicsItem *> estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const;