diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2009-04-15 10:39:09 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-04-15 10:39:09 (GMT) |
commit | efb0f94e592fca447c37e5f729015fa3ba97b1c2 (patch) | |
tree | 57d95e1e5b2c0ca47c608727907877e53009e6f5 /src/gui/graphicsview | |
parent | 8c8eac0a780c719f487c89009988d582c1db1112 (diff) | |
download | Qt-efb0f94e592fca447c37e5f729015fa3ba97b1c2.zip Qt-efb0f94e592fca447c37e5f729015fa3ba97b1c2.tar.gz Qt-efb0f94e592fca447c37e5f729015fa3ba97b1c2.tar.bz2 |
Revert "Fixup update rect regression by adjusting expose rectangles."
This reverts commit 66fe4167b123c644874216af4f1c1a2fb3c478b2.
Oops, missed the bit in the comment about not fixing for a 4.5 patch
release.
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r-- | src/gui/graphicsview/qgraphicsview.cpp | 42 |
1 files changed, 8 insertions, 34 deletions
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 716798d..2e6c08d 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -1046,24 +1046,13 @@ void QGraphicsViewPrivate::freeStyleOptionsArray(QStyleOptionGraphicsItem *array extern QPainterPath qt_regionToPath(const QRegion ®ion); -/*! - ### Adjustments in findItems: mapToScene(QRect) forces us to adjust the - input rectangle by (0, 0, 1, 1), because it uses QRect::bottomRight() - (etc) when mapping the rectangle to a polygon (which is _wrong_). In - addition, as QGraphicsItem::boundingRect() is defined in logical space, - but the default pen for QPainter is cosmetic with a width of 0, QPainter - is at risk of painting 1 pixel outside the bounding rect. Therefore we - must search for items with an adjustment of (-1, -1, 1, 1). -*/ QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedRegion, bool *allItems) const { Q_Q(const QGraphicsView); + const QPainterPath exposedPath(qt_regionToPath(exposedRegion)); + const QPainterPath exposedScenePath(q->mapToScene(exposedPath)); - // Step 1) If all items are contained within the expose region, then - // return a list of all visible items. - const QRectF exposedRegionSceneBounds = q->mapToScene(exposedRegion.boundingRect().adjusted(-1, -1, 2, 2)) - .boundingRect(); - if (exposedRegionSceneBounds.contains(scene->d_func()->growingItemsBoundingRect)) { + if (exposedScenePath.contains(scene->d_func()->growingItemsBoundingRect)) { Q_ASSERT(allItems); *allItems = true; @@ -1083,27 +1072,12 @@ QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedReg return itemList; } - // Step 2) If the expose region is a simple rect and the view is only - // translated or scaled, search for items using - // QGraphicsScene::items(QRectF). - bool simpleRectLookup = (scene->d_func()->largestUntransformableItem.isNull() - && exposedRegion.numRects() == 1 && matrix.type() <= QTransform::TxScale); - if (simpleRectLookup) { - return scene->d_func()->items_helper(exposedRegionSceneBounds, - Qt::IntersectsItemBoundingRect, - Qt::DescendingOrder); - } - - // If the region is complex or the view has a complex transform, adjust - // the expose region, convert it to a path, and then search for items - // using QGraphicsScene::items(QPainterPath); - QRegion adjustedRegion; - foreach (const QRect &r, exposedRegion.rects()) - adjustedRegion += r.adjusted(-1, -1, 1, 1); - - const QPainterPath exposedPath(qt_regionToPath(adjustedRegion)); if (scene->d_func()->largestUntransformableItem.isNull()) { - const QPainterPath exposedScenePath(q->mapToScene(exposedPath)); + if (exposedRegion.numRects() == 1 && matrix.type() <= QTransform::TxScale) { + return scene->d_func()->items_helper(exposedScenePath.controlPointRect(), + Qt::IntersectsItemBoundingRect, + Qt::DescendingOrder); + } return scene->d_func()->items_helper(exposedScenePath, Qt::IntersectsItemBoundingRect, Qt::DescendingOrder); |