summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp11
-rw-r--r--tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp2
2 files changed, 9 insertions, 4 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 8bbe929..c879c5c 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -10684,9 +10684,14 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
QRectF effectRectF;
if (mode == QGraphicsEffect::PadToEffectiveBoundingRect) {
- effectRectF = item->graphicsEffect()->boundingRectFor(boundingRect(Qt::DeviceCoordinates));
- if (system == Qt::LogicalCoordinates)
- effectRectF = info->painter->worldTransform().inverted().mapRect(effectRectF);
+ if (info) {
+ effectRectF = item->graphicsEffect()->boundingRectFor(boundingRect(Qt::DeviceCoordinates));
+ if (info && system == Qt::LogicalCoordinates)
+ effectRectF = info->painter->worldTransform().inverted().mapRect(effectRectF);
+ } else {
+ // no choice but to send a logical coordinate bounding rect to boundingRectFor
+ effectRectF = item->graphicsEffect()->boundingRectFor(sourceRect);
+ }
} else if (mode == QGraphicsEffect::PadToTransparentBorder) {
// adjust by 1.5 to account for cosmetic pens
effectRectF = sourceRect.adjusted(-1.5, -1.5, 1.5, 1.5);
diff --git a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
index 9991ab4..7a0d40a 100644
--- a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
+++ b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
@@ -352,7 +352,7 @@ void tst_QGraphicsEffectSource::pixmapPadding_data()
QTest::newRow("log,effectrect") << int(Qt::LogicalCoordinates)
<< int(QGraphicsEffect::PadToEffectiveBoundingRect)
- << QSize(30, 30) << QPoint(-10, -10)
+ << QSize(20, 20) << QPoint(-5, -5)
<< 0x00000000u;
QTest::newRow("dev,nopad") << int(Qt::DeviceCoordinates)