summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-07-02 12:59:51 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-07-02 12:59:51 (GMT)
commitc4ae87721e011fe44f301c4039f0651a05394162 (patch)
treec5e35a6360a7b93463ae627a8781a3b0ad138499 /src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp
parent6d71de4283c05b1b42ef26fe4c23334ad34c8a54 (diff)
downloadQt-c4ae87721e011fe44f301c4039f0651a05394162.zip
Qt-c4ae87721e011fe44f301c4039f0651a05394162.tar.gz
Qt-c4ae87721e011fe44f301c4039f0651a05394162.tar.bz2
Speedup item-lookup in Graphics View.
We don't have to do a stable sort anymore because the lessThan operator now accounts for the insertion order. This also means we don't have to sort all top-level items to preserve the insertion order in QGraphicsScenePrivate::topLevelItemsInStackingOrder. Reviewed-by: Andreas
Diffstat (limited to 'src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp')
-rw-r--r--src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp
index c8d755e..0688cb1 100644
--- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp
+++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp
@@ -242,7 +242,7 @@ void QGraphicsSceneBspTreeIndexPrivate::climbTree(QGraphicsItem *item, int *stac
{
if (!item->d_ptr->children.isEmpty()) {
QList<QGraphicsItem *> childList = item->d_ptr->children;
- qStableSort(childList.begin(), childList.end(), qt_closestLeaf);
+ qSort(childList.begin(), childList.end(), qt_closestLeaf);
for (int i = 0; i < childList.size(); ++i) {
QGraphicsItem *item = childList.at(i);
if (!(item->flags() & QGraphicsItem::ItemStacksBehindParent))
@@ -281,7 +281,7 @@ void QGraphicsSceneBspTreeIndexPrivate::_q_updateSortCache()
topLevels << item;
}
- qStableSort(topLevels.begin(), topLevels.end(), qt_closestLeaf);
+ qSort(topLevels.begin(), topLevels.end(), qt_closestLeaf);
for (int i = 0; i < topLevels.size(); ++i)
climbTree(topLevels.at(i), &stackingOrder);
}
@@ -446,15 +446,15 @@ void QGraphicsSceneBspTreeIndexPrivate::sortItems(QList<QGraphicsItem *> *itemLi
{
if (sortCacheEnabled) {
if (order == Qt::AscendingOrder) {
- qStableSort(itemList->begin(), itemList->end(), closestItemFirst_withCache);
+ qSort(itemList->begin(), itemList->end(), closestItemFirst_withCache);
} else if (order == Qt::DescendingOrder) {
- qStableSort(itemList->begin(), itemList->end(), closestItemLast_withCache);
+ qSort(itemList->begin(), itemList->end(), closestItemLast_withCache);
}
} else {
if (order == Qt::AscendingOrder) {
- qStableSort(itemList->begin(), itemList->end(), closestItemFirst_withoutCache);
+ qSort(itemList->begin(), itemList->end(), closestItemFirst_withoutCache);
} else if (order == Qt::DescendingOrder) {
- qStableSort(itemList->begin(), itemList->end(), closestItemLast_withoutCache);
+ qSort(itemList->begin(), itemList->end(), closestItemLast_withoutCache);
}
}
}