diff options
author | Alexis Menard <alexis.menard@nokia.com> | 2010-05-05 07:37:01 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@nokia.com> | 2010-05-05 07:37:01 (GMT) |
commit | 44144cf60e978f7d5d70aec49d114d57832a78c3 (patch) | |
tree | 16f60f3d66ef90e1fe6df624ec8a5805a4b8335d /src/gui/graphicsview/qgraphicsitem.cpp | |
parent | f560032067ee6b2e4c1badf34cc92e01ec5e9afa (diff) | |
download | Qt-44144cf60e978f7d5d70aec49d114d57832a78c3.zip Qt-44144cf60e978f7d5d70aec49d114d57832a78c3.tar.gz Qt-44144cf60e978f7d5d70aec49d114d57832a78c3.tar.bz2 |
Fix a bug in QGraphicsItem::scroll.
If the rect argument is null, well we should not do the scrolling with
an null rectangle but rather with the boundingRect like the documentation
says.
Task-number:QTBUG-10400
Reviewed-by:janarve
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem.cpp')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 326f130..81138d9 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -5635,8 +5635,9 @@ void QGraphicsItem::scroll(qreal dx, qreal dy, const QRectF &rect) // Adjust with 2 pixel margin. Notice the loss of precision // when converting to QRect. int adjust = 2; + QRectF scrollRect = !rect.isNull() ? rect : boundingRect(); QRectF br = boundingRect().adjusted(-adjust, -adjust, adjust, adjust); - QRect irect = rect.toRect().translated(-br.x(), -br.y()); + QRect irect = scrollRect.toRect().translated(-br.x(), -br.y()); pix.scroll(dx, dy, irect); @@ -5644,11 +5645,11 @@ void QGraphicsItem::scroll(qreal dx, qreal dy, const QRectF &rect) // Translate the existing expose. foreach (QRectF exposedRect, c->exposed) - c->exposed += exposedRect.translated(dx, dy) & rect; + c->exposed += exposedRect.translated(dx, dy) & scrollRect; // Calculate exposure. QRegion exposed; - QRect r = rect.toRect(); + QRect r = scrollRect.toRect(); exposed += r; exposed -= r.translated(dx, dy); foreach (QRect rect, exposed.rects()) |