diff options
author | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-06-09 15:45:04 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-06-09 16:50:42 (GMT) |
commit | 2af18f51f216d5c624ce28b3fa966a17050d882b (patch) | |
tree | 41a68e7f7a24c7e9e7488676c66ee98521f3c26b /src/gui/graphicsview/qgraphicsitem.cpp | |
parent | 6185ff436816738e933e3c88d44c45faa7f401f7 (diff) | |
download | Qt-2af18f51f216d5c624ce28b3fa966a17050d882b.zip Qt-2af18f51f216d5c624ce28b3fa966a17050d882b.tar.gz Qt-2af18f51f216d5c624ce28b3fa966a17050d882b.tar.bz2 |
Fix sorting bug when using BSP tree index + add autotest.
We use stable sorting to keep insertion order. This works fine as long
as we sort a complete list of siblings in one go, and this list already
has items in insertion order. But if we shuffle such a list, the only
way to get proper sort order again (with insertion order intact), is
if each item has a sibling index. We used to have this, but we don't
have it anymore (as it's not needed for NoIndex mode).
So until we separate the BSP index into a separate class and add this
index there, we add this workaround which uses the toplevelitems list
to ensure the items have the correct order.
Reviewed-by: bnilsen
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem.cpp')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index db16213..f50d210 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -6190,10 +6190,8 @@ void QGraphicsItem::addToIndex() // ### add to child index only if applicable return; } - if (d_ptr->scene) { + if (d_ptr->scene) d_ptr->scene->d_func()->addToIndex(this); - d_ptr->scene->d_func()->markDirty(this); - } } /*! @@ -6209,10 +6207,8 @@ void QGraphicsItem::removeFromIndex() // ### remove from child index only if applicable return; } - if (d_ptr->scene) { - d_ptr->scene->d_func()->markDirty(this); + if (d_ptr->scene) d_ptr->scene->d_func()->removeFromIndex(this); - } } /*! |