summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorAriya Hidayat <ariya.hidayat@trolltech.com>2009-03-16 14:07:06 (GMT)
committerAlexis Menard <alexis.menard@trolltech.com>2009-04-07 18:16:27 (GMT)
commit2a1ced292424501d3bf453f337f8ce9c8c17bda9 (patch)
treecd0d89b1633fbe273f038783949d0d299c212d65 /src/gui
parent7185361703e2837e4258b18350da791c84f7ef62 (diff)
downloadQt-2a1ced292424501d3bf453f337f8ce9c8c17bda9.zip
Qt-2a1ced292424501d3bf453f337f8ce9c8c17bda9.tar.gz
Qt-2a1ced292424501d3bf453f337f8ce9c8c17bda9.tar.bz2
Fixes: Initialize the BSP tree if it has not been initialized before.
Details: The BSP tree internal to QGraphicsScene does need this as the scene does call initialize() at proper time. This fix is needed only for using the BSP tree as custom indexing and/or for autotest.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/graphicsview/qgraphicsscene_bsp.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene_bsp.cpp b/src/gui/graphicsview/qgraphicsscene_bsp.cpp
index bf95893..b73cba2 100644
--- a/src/gui/graphicsview/qgraphicsscene_bsp.cpp
+++ b/src/gui/graphicsview/qgraphicsscene_bsp.cpp
@@ -247,8 +247,10 @@ void QGraphicsSceneBspTree::initialize(const QRectF &rect, int depth, int index)
void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QPointF &pos, int index)
{
- if (nodes.isEmpty())
- return;
+ if (nodes.isEmpty()) {
+ // should never happen for bsp tree internal to QGraphicsScene
+ initialize(sceneRect, 0);
+ }
const Node &node = nodes.at(index);
int childIndex = firstChildIndex(index);
@@ -277,8 +279,10 @@ void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, con
void QGraphicsSceneBspTree::climbTree(QGraphicsSceneBspTreeVisitor *visitor, const QRectF &rect, int index)
{
- if (nodes.isEmpty())
- return;
+ if (nodes.isEmpty()) {
+ // should never happen for bsp tree internal to QGraphicsScene
+ initialize(sceneRect, 0);
+ }
const Node &node = nodes.at(index);
int childIndex = firstChildIndex(index);