summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@trolltech.com>2009-04-07 18:02:09 (GMT)
committerAlexis Menard <alexis.menard@trolltech.com>2009-04-07 18:02:09 (GMT)
commita7f4886b896751ed52db474514a2c4244ed6fc14 (patch)
treee393ef9fc621e65134cf82c0c39b299c66f913e6
parent030554d7527663bd389b681f2e2c7e8262517013 (diff)
downloadQt-a7f4886b896751ed52db474514a2c4244ed6fc14.zip
Qt-a7f4886b896751ed52db474514a2c4244ed6fc14.tar.gz
Qt-a7f4886b896751ed52db474514a2c4244ed6fc14.tar.bz2
Fixes: Some modifications after a talk with Ariya
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp7
-rw-r--r--src/gui/graphicsview/qgraphicsscene.h2
-rw-r--r--src/gui/graphicsview/qgraphicssceneindex.cpp6
-rw-r--r--src/gui/graphicsview/qgraphicssceneindex.h11
4 files changed, 20 insertions, 6 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index e74ae3a..fc9590f 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -491,7 +491,7 @@ void QGraphicsScenePrivate::removeFromIndex(QGraphicsItem *item)
void QGraphicsScenePrivate::resetIndex()
{
purgeRemovedItems();
- if (indexMethod == QGraphicsScene::BspTreeIndex) {
+ if (indexMethod != QGraphicsScene::NoIndex) {
for (int i = 0; i < indexedItems.size(); ++i) {
if (QGraphicsItem *item = indexedItems.at(i)) {
item->d_ptr->index = -1;
@@ -2393,12 +2393,13 @@ void QGraphicsScene::setSceneIndex(QGraphicsSceneIndex *index)
} else {
d->indexMethod = CustomIndex;
d->customIndex = index;
+ index->mscene = this;
}
}
-QGraphicsSceneIndex* QGraphicsScene::sceneIndex()
+QGraphicsSceneIndex* QGraphicsScene::sceneIndex() const
{
- Q_D(QGraphicsScene);
+ Q_D(const QGraphicsScene);
return d->customIndex;
}
diff --git a/src/gui/graphicsview/qgraphicsscene.h b/src/gui/graphicsview/qgraphicsscene.h
index 7e1e040..bb3cea7 100644
--- a/src/gui/graphicsview/qgraphicsscene.h
+++ b/src/gui/graphicsview/qgraphicsscene.h
@@ -145,7 +145,7 @@ public:
ItemIndexMethod itemIndexMethod() const;
void setItemIndexMethod(ItemIndexMethod method);
void setSceneIndex(QGraphicsSceneIndex *index);
- QGraphicsSceneIndex* sceneIndex();
+ QGraphicsSceneIndex* sceneIndex() const;
bool isSortCacheEnabled() const;
void setSortCacheEnabled(bool enabled);
diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp
index 00c63a3..7868388 100644
--- a/src/gui/graphicsview/qgraphicssceneindex.cpp
+++ b/src/gui/graphicsview/qgraphicssceneindex.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "qgraphicssceneindex.h"
+#include "qgraphicsscene.h"
#ifndef QT_NO_GRAPHICSVIEW
@@ -54,6 +55,11 @@ QGraphicsSceneIndex::~QGraphicsSceneIndex()
}
+QGraphicsScene* QGraphicsSceneIndex::scene()
+{
+ return mscene;
+}
+
QT_END_NAMESPACE
//#include "moc_qgraphicssceneindex.cpp"
diff --git a/src/gui/graphicsview/qgraphicssceneindex.h b/src/gui/graphicsview/qgraphicssceneindex.h
index 8e8c3ea..a56634d 100644
--- a/src/gui/graphicsview/qgraphicssceneindex.h
+++ b/src/gui/graphicsview/qgraphicssceneindex.h
@@ -53,10 +53,10 @@ QT_MODULE(Gui)
#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
class QGraphicsItem;
+class QGraphicsScene;
class QRectF;
class QPointF;
template<typename T> class QList;
-template<typename T> class QSet;
class Q_GUI_EXPORT QGraphicsSceneIndex
{
@@ -64,13 +64,20 @@ public:
QGraphicsSceneIndex();
virtual ~QGraphicsSceneIndex();
- virtual void initialize(const QRectF &rect) = 0;
+ virtual void setRect(const QRectF &rect) = 0;
+ virtual QRectF rect() const = 0;
virtual void clear() = 0;
virtual void insertItem(QGraphicsItem *item, const QRectF &rect) = 0;
+ virtual void insertItems(QList<QGraphicsItem *> items, const QRectF &rect) = 0;
virtual void removeItem(QGraphicsItem *item, const QRectF &rect) = 0;
+ virtual void removeItems(QList<QGraphicsItem *> items, const QRectF &rect) = 0;
virtual QList<QGraphicsItem *> items(const QRectF &rect) = 0;
+
+ QGraphicsScene* scene();
+
+ QGraphicsScene* mscene;
};
#endif // QT_NO_GRAPHICSVIEW