summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 4c7765d..b7c2e26 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -10357,10 +10357,14 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
effectRect.setY(0);
}
// NB! We use +-1 for historical reasons (see QRect documentation).
- if (right + 1 > info->widget->width())
- effectRect.setRight(info->widget->width() - 1);
- if (bottom + 1 > info->widget->height())
- effectRect.setBottom(info->widget->height() -1);
+ QPaintDevice *device = info->painter->device();
+ const int deviceWidth = device->width();
+ const int deviceHeight = device->height();
+ if (right + 1 > deviceWidth)
+ effectRect.setRight(deviceWidth - 1);
+ if (bottom + 1 > deviceHeight)
+ effectRect.setBottom(deviceHeight -1);
+
}
if (effectRect.isEmpty())