diff options
author | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-06-17 12:36:55 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-06-17 12:36:55 (GMT) |
commit | 625dadcc9b88dccebf607b84089ab960740b94f2 (patch) | |
tree | a2b11f2c932e9263b2e3004558226f38f4a90a21 | |
parent | 5d682567d1acb79b2fa55ae8f005c5dcdc9aacb7 (diff) | |
download | Qt-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.cpp | 3 |
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)); } /*! |