diff options
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qwidget/tst_qwidget.cpp | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index fb9c8cb..b96d8b3 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -4805,7 +4805,7 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset, Q_ASSERT(engine); QPaintEnginePrivate *enginePriv = engine->d_func(); Q_ASSERT(enginePriv); - QPaintDevice *target = painter->worldMatrixEnabled() ? engine->paintDevice() : painter->device(); + QPaintDevice *target = engine->paintDevice(); Q_ASSERT(target); // Render via a pixmap when dealing with non-opaque painters or printers. diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index dee48a3..5896df9 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -287,6 +287,7 @@ private slots: void render_systemClip2(); void render_systemClip3_data(); void render_systemClip3(); + void render_task252837(); void setContentsMargins(); @@ -7097,6 +7098,16 @@ void tst_QWidget::render_systemClip3() } } +void tst_QWidget::render_task252837() +{ + QWidget widget; + widget.resize(200, 200); + + QPixmap pixmap(widget.size()); + QPainter painter(&pixmap); + // Please do not crash. + widget.render(&painter); +} void tst_QWidget::setContentsMargins() { QLabel label("why does it always rain on me?"); |