From 55911952c7b195e36614372d084c473202ab1c44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 9 Nov 2010 10:53:43 +0100 Subject: Fixed tst_qwidget::testContentsPropagation auto-test failure. Some auto-tests render into a QPixmap and check the result against QPixmap::grabWidget(). Change acc1a2bd5520369c made grabWidget() render into a QImage to be able to preserve background transparency. Instead, to avoid breaking various auto-tests, we can use a QPixmap and fill it with transparent if the widget's isOpaque flag is not set. Task-number: QTBUG-14945 Reviewed-by: Kim --- src/gui/image/qpixmap.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 290c0f0..c5d9a7e 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1101,11 +1101,13 @@ QPixmap QPixmap::grabWidget(QWidget * widget, const QRect &rect) if (!r.intersects(widget->rect())) return QPixmap(); - QImage res(r.size(), QImage::Format_ARGB32_Premultiplied); - res.fill(0); + QPixmap res(r.size()); + if (!qt_widget_private(widget)->isOpaque) + res.fill(Qt::transparent); + widget->d_func()->render(&res, QPoint(), r, QWidget::DrawWindowBackground | QWidget::DrawChildren | QWidget::IgnoreMask, true); - return QPixmap::fromImage(res); + return res; } /*! -- cgit v0.12