summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2010-11-09 09:53:43 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2010-11-09 10:03:10 (GMT)
commit55911952c7b195e36614372d084c473202ab1c44 (patch)
treece0b1165227eacec8e1c034da6c545f264dc0d18 /src/gui
parent8d8f14314138139c8e538763fb6bb12f214587cf (diff)
downloadQt-55911952c7b195e36614372d084c473202ab1c44.zip
Qt-55911952c7b195e36614372d084c473202ab1c44.tar.gz
Qt-55911952c7b195e36614372d084c473202ab1c44.tar.bz2
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
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/image/qpixmap.cpp8
1 files 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;
}
/*!