diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp index e6ce275bef..7b381367c3 100644 --- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp +++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp @@ -1576,6 +1576,10 @@ void QGraphicsProxyWidget::paint(QPainter *painter, const QStyleOptionGraphicsIt if (exposedWidgetRect.isEmpty()) return; + // When rendering to pdf etc. painting may go outside widget boundaries unless clipped + if (painter->device()->devType() != QInternal::Widget && (flags() & ItemClipsChildrenToShape)) + painter->setClipRect(d->widget->geometry(), Qt::IntersectClip); + d->widget->render(painter, exposedWidgetRect.topLeft(), exposedWidgetRect); }