summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-06-17 12:36:55 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-06-17 12:36:55 (GMT)
commit625dadcc9b88dccebf607b84089ab960740b94f2 (patch)
treea2b11f2c932e9263b2e3004558226f38f4a90a21
parent5d682567d1acb79b2fa55ae8f005c5dcdc9aacb7 (diff)
downloadQt-625dadcc9b88dccebf607b84089ab960740b94f2.zip
Qt-625dadcc9b88dccebf607b84089ab960740b94f2.tar.gz
Qt-625dadcc9b88dccebf607b84089ab960740b94f2.tar.bz2
Don't lose all the items when we switch item index method.
Readd the items to the new index. Reviewed-by: Alexis
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index dacfc87..36af30d 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -1535,11 +1535,14 @@ void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method)
d->indexMethod = method;
+ QList<QGraphicsItem *> oldItems = d->index->items();
delete d->index;
if (method == BspTreeIndex)
d->index = new QGraphicsSceneBspTreeIndex(this);
else
d->index = new QGraphicsSceneLinearIndex(this);
+ for (int i = 0; i < oldItems.size(); ++i)
+ d->index->addItem(oldItems.at(i));
}
/*!