summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2009-06-03 16:23:20 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2009-06-03 16:23:20 (GMT)
commitffd6bc0351c96c8a3828bd7376f2b6bda317cd71 (patch)
tree4d2879a9f3525eb0c88df54d21dba71b4748586f /src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h
parent427c4d6b0a8b3004c86facd382de33c171c0458b (diff)
downloadQt-ffd6bc0351c96c8a3828bd7376f2b6bda317cd71.zip
Qt-ffd6bc0351c96c8a3828bd7376f2b6bda317cd71.tar.gz
Qt-ffd6bc0351c96c8a3828bd7376f2b6bda317cd71.tar.bz2
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/qgraphicsscenebsptreeindex_p.h')
-rw-r--r--src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h51
1 files changed, 18 insertions, 33 deletions
diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h
index 7a6ea0b..b1ea977 100644
--- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h
+++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h
@@ -56,56 +56,41 @@ QT_BEGIN_NAMESPACE
#include "qgraphicsscene_bsp_p.h"
+class QGraphicsSceneBspTreeIndexPrivate;
class Q_AUTOTEST_EXPORT QGraphicsSceneBspTreeIndex : public QGraphicsSceneIndex
{
Q_OBJECT
public:
QGraphicsSceneBspTreeIndex(QGraphicsScene *scene = 0);
- QRectF indexedRect();
-
- void clear();
-
- void addItem(QGraphicsItem *item);
- void removeItem(QGraphicsItem *item);
- void deleteItem(QGraphicsItem *item);
- void prepareBoundingRectChange(const QGraphicsItem *item);
+ QRectF indexedRect() const;
QList<QGraphicsItem *> estimateItems(const QRectF &rect, Qt::SortOrder order, const QTransform &deviceTransform) const;
- QList<QGraphicsItem *> items() const;
+ QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::AscendingOrder) const;
int bspDepth();
void setBspDepth(int depth);
protected:
bool event(QEvent *event);
- void sceneRectChanged(const QRectF &rect);
+ void clear();
+
+ void addItem(QGraphicsItem *item);
+ void removeItem(QGraphicsItem *item);
+ void deleteItem(QGraphicsItem *item);
+ void prepareBoundingRectChange(const QGraphicsItem *item);
-public slots :
- void _q_updateIndex();
+ void sceneRectChanged(const QRectF &rect);
+ void itemChanged(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value);
private :
- QGraphicsSceneBspTree bsp;
- QRectF m_sceneRect;
- int bspTreeDepth;
- int indexTimerId;
- bool restartIndexTimer;
- bool regenerateIndex;
- int lastItemCount;
-
- QList<QGraphicsItem *> m_indexedItems;
- QList<QGraphicsItem *> unindexedItems;
- QList<int> freeItemIndexes;
-
- bool purgePending;
- QList<QGraphicsItem *> removedItems;
- void purgeRemovedItems();
-
- void startIndexTimer();
- void resetIndex();
-
- void addToIndex(QGraphicsItem *item);
- void removeFromIndex(QGraphicsItem *item);
+ Q_DECLARE_PRIVATE(QGraphicsSceneBspTreeIndex)
+ Q_DISABLE_COPY(QGraphicsSceneBspTreeIndex)
+ Q_PRIVATE_SLOT(d_func(), void _q_updateSortCache())
+ Q_PRIVATE_SLOT(d_func(), void _q_updateIndex())
+
+ friend class QGraphicsScene;
+ friend class QGraphicsScenePrivate;
};
QT_END_NAMESPACE