diff options
author | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-06-08 17:50:14 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-06-09 07:43:42 (GMT) |
commit | f84782506770f99e9633649483e4dd067e3abcd5 (patch) | |
tree | 198ab5dfa162385bf8a7124e23013fa68513f5b0 /src | |
parent | e2e039954b2212a9cee0b7f72e383621f8bc6c8f (diff) | |
download | Qt-f84782506770f99e9633649483e4dd067e3abcd5.zip Qt-f84782506770f99e9633649483e4dd067e3abcd5.tar.gz Qt-f84782506770f99e9633649483e4dd067e3abcd5.tar.bz2 |
Fix QGraphicsView::render() regression, ensure the right device is passed.
If we pass the viewport widget as the widget pointer when rendering to
an arbitrary painter (e.g., onto a pixmap), we confuse the rendering
functions to thinking that it's the viewport's region we should render
into. So instead, when drawItems() is passed a painter that's different
from the view, we pass 0 for the widget.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/graphicsview/qgraphicsview.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 166bcb9..e685f9b 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -3526,8 +3526,10 @@ void QGraphicsView::drawItems(QPainter *painter, int numItems, const QStyleOptionGraphicsItem options[]) { Q_D(QGraphicsView); - if (d->scene) - d->scene->drawItems(painter, numItems, items, options, viewport()); + if (d->scene) { + QWidget *widget = painter->device() == viewport() ? viewport() : 0; + d->scene->drawItems(painter, numItems, items, options, widget); + } } /*! |