diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-12-10 11:52:10 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-12-10 12:39:14 (GMT) |
commit | 6db96dcd4acccbc13161f85adf3164907b7b5cae (patch) | |
tree | ba8d688c35ea64730a50798730ba0993fe23df4a /src/gui/graphicsview/qgraphicsview.cpp | |
parent | f22916fe55547f530f31df56e8e49462899688a0 (diff) | |
download | Qt-6db96dcd4acccbc13161f85adf3164907b7b5cae.zip Qt-6db96dcd4acccbc13161f85adf3164907b7b5cae.tar.gz Qt-6db96dcd4acccbc13161f85adf3164907b7b5cae.tar.bz2 |
Fix redraw bugs when using graphics effects in device coordinate mode.
QGraphicsEffect::boundingRectFor() needs the source bounding rect in
device coordinates. This patch fixes the documentation to reflect this,
and fixes some internal usage of boundingRectFor() to ensure it always
gets the device rect of the source.
Task-number: QTBUG-5918
Reviewed-by: Bjørn Erik Nilsen
Diffstat (limited to 'src/gui/graphicsview/qgraphicsview.cpp')
-rw-r--r-- | src/gui/graphicsview/qgraphicsview.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 3f9f443..ffe64aa 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -545,6 +545,32 @@ qint64 QGraphicsViewPrivate::verticalScroll() const /*! \internal + + Maps the given rectangle to the scene using QTransform::mapRect() +*/ +QRectF QGraphicsViewPrivate::mapRectToScene(const QRect &rect) const +{ + if (dirtyScroll) + const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); + QRectF scrolled = QRectF(rect.translated(scrollX, scrollY)); + return identityMatrix ? scrolled : matrix.inverted().mapRect(scrolled); +} + + +/*! + \internal + + Maps the given rectangle from the scene using QTransform::mapRect() +*/ +QRectF QGraphicsViewPrivate::mapRectFromScene(const QRectF &rect) const +{ + if (dirtyScroll) + const_cast<QGraphicsViewPrivate *>(this)->updateScroll(); + return (identityMatrix ? rect : matrix.mapRect(rect)).translated(-scrollX, -scrollY); +} + +/*! + \internal */ void QGraphicsViewPrivate::updateScroll() { |