summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicssceneindex.cpp
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2009-06-03 18:23:20 +0200
committerAlexis Menard <alexis.menard@nokia.com>2009-06-03 18:23:20 +0200
commitffd6bc0351c96c8a3828bd7376f2b6bda317cd71 (patch)
tree4d2879a9f3525eb0c88df54d21dba71b4748586f /src/gui/graphicsview/qgraphicssceneindex.cpp
parent427c4d6b0a8b3004c86facd382de33c171c0458b (diff)
Remove the sorting cache from the QGraphicsScene and move it to the BSP.
Now the QGraphicsScene has no idea how works the index. So we can improve it separatly, add new ones and benchmarks existing ones.
Diffstat (limited to 'src/gui/graphicsview/qgraphicssceneindex.cpp')
-rw-r--r--src/gui/graphicsview/qgraphicssceneindex.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp
index d0d6081246..eeee74e178 100644
--- a/src/gui/graphicsview/qgraphicssceneindex.cpp
+++ b/src/gui/graphicsview/qgraphicssceneindex.cpp
@@ -41,6 +41,7 @@
#include "qgraphicssceneindex.h"
#include "qgraphicssceneindex_p.h"
+#include "qgraphicsscenebsptreeindex_p_p.h"
#include "qgraphicsscene.h"
#include "qgraphicsitem_p.h"
#include "qgraphicsscene_p.h"
@@ -282,6 +283,14 @@ QGraphicsSceneIndex::QGraphicsSceneIndex(QGraphicsScene *scene)
}
/*!
+ \internal
+*/
+QGraphicsSceneIndex::QGraphicsSceneIndex(QObjectPrivate &dd, QGraphicsScene *scene)
+ : QObject(dd, scene)
+{
+}
+
+/*!
Destroys the scene index.
*/
QGraphicsSceneIndex::~QGraphicsSceneIndex()
@@ -301,7 +310,7 @@ QGraphicsScene* QGraphicsSceneIndex::scene() const
/*!
Returns the indexed area for the index
*/
-QRectF QGraphicsSceneIndex::indexedRect()
+QRectF QGraphicsSceneIndex::indexedRect() const
{
Q_D(const QGraphicsSceneIndex);
return d->scene->d_func()->sceneRect;
@@ -351,8 +360,9 @@ QList<QGraphicsItem *> QGraphicsSceneIndex::items(const QPointF &pos, Qt::ItemSe
d->childItems_helper(&items, item, xinv.map(pos));
}
}
-
- d->scene->d_func()->sortItems(&items, order, d->scene->d_func()->sortCacheEnabled);
+ //### Needed but it should be handle differently
+ if (order != Qt::SortOrder(-1))
+ QGraphicsSceneBspTreeIndexPrivate::sortItems(&items, order, false);
return items;
}
@@ -415,9 +425,9 @@ QList<QGraphicsItem *> QGraphicsSceneIndex::items(const QRectF &rect, Qt::ItemSe
}
}
}
-
+ //### Needed but it should be handle differently
if (order != Qt::SortOrder(-1))
- d->scene->d_func()->sortItems(&items, order, d->scene->d_func()->sortCacheEnabled);
+ QGraphicsSceneBspTreeIndexPrivate::sortItems(&items, order, false);
return items;
}
@@ -474,9 +484,9 @@ QList<QGraphicsItem *> QGraphicsSceneIndex::items(const QPolygonF &polygon, Qt::
d->childItems_helper(&items, item, xinv.map(polygon), mode);
}
}
-
+ //### Needed but it should be handle differently
if (order != Qt::SortOrder(-1))
- d->scene->d_func()->sortItems(&items, order, d->scene->d_func()->sortCacheEnabled);
+ QGraphicsSceneBspTreeIndexPrivate::sortItems(&items, order, false);
return items;
}
QList<QGraphicsItem *> QGraphicsSceneIndex::items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const
@@ -525,9 +535,9 @@ QList<QGraphicsItem *> QGraphicsSceneIndex::items(const QPainterPath &path, Qt::
d->childItems_helper(&items, item, xinv.map(path), mode);
}
}
-
+ //### Needed but it should be handle differently
if (order != Qt::SortOrder(-1))
- d->scene->d_func()->sortItems(&items, order, d->scene->d_func()->sortCacheEnabled);
+ QGraphicsSceneBspTreeIndexPrivate::sortItems(&items, order, false);
return items;
}