From 5127105efd8f76721d7d9acf9681fd18e73760d8 Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Thu, 4 Jun 2009 15:16:40 +0200 Subject: Fix clipping bug, move code to avoid unintentional shadowing. The children variable tested for clipping was the wrong variable. This broke when the code was moved down as part of a previous cleanup change. Reviewed-by: bnilsen --- src/gui/graphicsview/qgraphicsscene.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 7a6c21c..a137b06 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -5152,20 +5152,6 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * } } - bool childClip = (item && (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape)); - bool dontDrawItem = !item || viewBoundingRect.isEmpty(); - bool dontDrawChildren = item && dontDrawItem && childClip; - childClip &= !dontDrawChildren & !children.isEmpty(); - if (item && item->d_ptr->flags & QGraphicsItem::ItemHasNoContents) - dontDrawItem = true; - - // Clip children. - if (childClip) { - painter->save(); - painter->setWorldTransform(transformTmp); - painter->setClipPath(item->shape(), Qt::IntersectClip); - } - // Find and sort children. QList tmp; QList *children = 0; @@ -5192,6 +5178,20 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * tmp = tli; children = &tmp; } + + bool childClip = (item && (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape)); + bool dontDrawItem = !item || viewBoundingRect.isEmpty(); + bool dontDrawChildren = item && dontDrawItem && childClip; + childClip &= !dontDrawChildren & !children->isEmpty(); + if (item && item->d_ptr->flags & QGraphicsItem::ItemHasNoContents) + dontDrawItem = true; + + // Clip children. + if (childClip) { + painter->save(); + painter->setWorldTransform(transformTmp); + painter->setClipPath(item->shape(), Qt::IntersectClip); + } if (!dontDrawChildren) { if (item && item->d_ptr->needSortChildren) { -- cgit v0.12