summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2010-05-05 07:37:01 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2010-05-05 07:37:01 (GMT)
commit44144cf60e978f7d5d70aec49d114d57832a78c3 (patch)
tree16f60f3d66ef90e1fe6df624ec8a5805a4b8335d /src
parentf560032067ee6b2e4c1badf34cc92e01ec5e9afa (diff)
downloadQt-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')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp7
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())