summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsscene_p.h
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/qgraphicsscene_p.h
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/qgraphicsscene_p.h')
-rw-r--r--src/gui/graphicsview/qgraphicsscene_p.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h
index 4842e72..23b0dd5 100644
--- a/src/gui/graphicsview/qgraphicsscene_p.h
+++ b/src/gui/graphicsview/qgraphicsscene_p.h
@@ -234,6 +234,14 @@ public:
item->d_ptr->ignoreOpacity = 0;
}
+ inline void ensureSortedTopLevelItems()
+ {
+ if (needSortTopLevelItems) {
+ qSort(topLevelItems.begin(), topLevelItems.end(), qt_notclosestLeaf);
+ needSortTopLevelItems = false;
+ }
+ }
+
QStyle *style;
QFont font;
void setFont_helper(const QFont &font);