summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-06-11 14:24:40 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-06-11 16:25:52 (GMT)
commita1786a441e9101500ae2c28a5226372ba0c7b4a2 (patch)
treee28b87d8cdf19e9903f879f7b37e4b5901109899 /src
parentfa5f3a4464f8265692c2ff50bd03b9b24b6ad912 (diff)
downloadQt-a1786a441e9101500ae2c28a5226372ba0c7b4a2.zip
Qt-a1786a441e9101500ae2c28a5226372ba0c7b4a2.tar.gz
Qt-a1786a441e9101500ae2c28a5226372ba0c7b4a2.tar.bz2
QGraphicsView: Replace update() with updateAll().
We have some nice cut-offs when there's a full update pending, but we don't know about it if we call update() directly on the viewport. Instead call QGraphicsViewPrivate::updateAll() which has the same effect, except that it also sets a flag telling us a full update is pending. Reviewed-by: Andreas
Diffstat (limited to 'src')
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp34
-rw-r--r--src/gui/graphicsview/qgraphicsview_p.h8
2 files changed, 20 insertions, 22 deletions
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index de7b9f4..4a32ee5 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -442,7 +442,7 @@ void QGraphicsViewPrivate::recalculateContentSize()
// scroll instead.
if (oldLeftIndent != leftIndent || oldTopIndent != topIndent) {
dirtyScroll = true;
- viewport->update();
+ updateAll();
} else if (q->isRightToLeft() && !leftIndent) {
// In reverse mode, the horizontal scroll always changes after the content
// size has changed, as the scroll is calculated by summing the min and
@@ -823,14 +823,6 @@ void QGraphicsViewPrivate::processPendingUpdates()
dirtyRegion = QRegion();
}
-void QGraphicsViewPrivate::updateAll()
-{
- viewport->update();
- fullUpdatePending = true;
- dirtyBoundingRect = QRect();
- dirtyRegion = QRegion();
-}
-
void QGraphicsViewPrivate::updateRegion(const QRegion &r)
{
if (r.isEmpty() || fullUpdatePending)
@@ -1084,7 +1076,7 @@ void QGraphicsView::setRenderHints(QPainter::RenderHints hints)
if (hints == d->renderHints)
return;
d->renderHints = hints;
- viewport()->update();
+ d->updateAll();
}
/*!
@@ -1102,7 +1094,7 @@ void QGraphicsView::setRenderHint(QPainter::RenderHint hint, bool enabled)
else
d->renderHints &= ~hint;
if (oldHints != d->renderHints)
- viewport()->update();
+ d->updateAll();
}
/*!
@@ -1389,7 +1381,7 @@ void QGraphicsView::resetCachedContent()
if (d->cacheMode & CacheBackground) {
// Background caching is enabled.
d->mustResizeBackgroundPixmap = true;
- viewport()->update();
+ d->updateAll();
} else if (d->mustResizeBackgroundPixmap) {
// Background caching is disabled.
// Cleanup, free some resources.
@@ -1478,7 +1470,7 @@ void QGraphicsView::setScene(QGraphicsScene *scene)
return;
// Always update the viewport when the scene changes.
- viewport()->update();
+ d->updateAll();
// Remove the previously assigned scene.
if (d->scene) {
@@ -2434,7 +2426,7 @@ void QGraphicsView::setBackgroundBrush(const QBrush &brush)
{
Q_D(QGraphicsView);
d->backgroundBrush = brush;
- viewport()->update();
+ d->updateAll();
if (d->cacheMode & CacheBackground) {
// Invalidate the background pixmap
@@ -2464,7 +2456,7 @@ void QGraphicsView::setForegroundBrush(const QBrush &brush)
{
Q_D(QGraphicsView);
d->foregroundBrush = brush;
- viewport()->update();
+ d->updateAll();
}
/*!
@@ -3062,7 +3054,7 @@ void QGraphicsView::mouseMoveEvent(QMouseEvent *event)
if (d->viewportUpdateMode != FullViewportUpdate)
viewport()->update(d->rubberBandRegion(viewport(), d->rubberBandRect));
else
- viewport()->update();
+ d->updateAll();
}
// Stop rubber banding if the user has let go of all buttons (even
@@ -3084,7 +3076,7 @@ void QGraphicsView::mouseMoveEvent(QMouseEvent *event)
if (d->viewportUpdateMode != FullViewportUpdate)
viewport()->update(d->rubberBandRegion(viewport(), d->rubberBandRect));
else
- viewport()->update();
+ d->updateAll();
}
// Set the new selection area
QPainterPath selectionArea;
@@ -3127,7 +3119,7 @@ void QGraphicsView::mouseReleaseEvent(QMouseEvent *event)
if (d->viewportUpdateMode != FullViewportUpdate)
viewport()->update(d->rubberBandRegion(viewport(), d->rubberBandRect));
else
- viewport()->update();
+ d->updateAll();
}
d->rubberBanding = false;
d->rubberBandRect = QRect();
@@ -3395,10 +3387,10 @@ void QGraphicsView::scrollContentsBy(int dx, int dy)
#endif
viewport()->scroll(dx, dy);
} else {
- viewport()->update();
+ d->updateAll();
}
} else {
- viewport()->update();
+ d->updateAll();
}
}
@@ -3611,7 +3603,7 @@ void QGraphicsView::setTransform(const QTransform &matrix, bool combine )
d->transforming = false;
// Any matrix operation requires a full update.
- viewport()->update();
+ d->updateAll();
}
/*!
diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h
index 814e476..00f3035 100644
--- a/src/gui/graphicsview/qgraphicsview_p.h
+++ b/src/gui/graphicsview/qgraphicsview_p.h
@@ -163,7 +163,13 @@ public:
QRegion dirtyRegion;
QRect dirtyBoundingRect;
void processPendingUpdates();
- void updateAll();
+ inline void updateAll()
+ {
+ viewport->update();
+ fullUpdatePending = true;
+ dirtyBoundingRect = QRect();
+ dirtyRegion = QRegion();
+ }
void updateRect(const QRect &rect);
void updateRegion(const QRegion &region);
bool updateSceneSlotReimplementedChecked;