summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2009-11-12 13:48:04 (GMT)
committerKim Motoyoshi Kalland <kim.kalland@nokia.com>2009-11-12 14:10:36 (GMT)
commit951cceac68b4a6cf38da83b69dcde2c8109342a2 (patch)
treef422c1a36f83a24937145abda08396b4d32ff03c /src/gui/image
parentb60ed9f084e45314787b84b686231ae68e0d39ba (diff)
downloadQt-951cceac68b4a6cf38da83b69dcde2c8109342a2.zip
Qt-951cceac68b4a6cf38da83b69dcde2c8109342a2.tar.gz
Qt-951cceac68b4a6cf38da83b69dcde2c8109342a2.tar.bz2
Fixed QPixmap::grabWidget() on widgets that have not yet been shown.
Fixed bug where QPixmap::grabWidget() would return a pixmap of a different size that the widget if the widget had not yet been shown or resized. Updated the qpixmap autotest. Task-number: QTBUG-4149 Reviewed-by: Trond
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qpixmap.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 985a20b..b085c09 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -1076,6 +1076,9 @@ QPixmap QPixmap::grabWidget(QWidget * widget, const QRect &rect)
if (widget->testAttribute(Qt::WA_PendingResizeEvent) || !widget->testAttribute(Qt::WA_WState_Created))
sendResizeEvents(widget);
+ widget->d_func()->prepareToRender(QRegion(),
+ QWidget::DrawWindowBackground | QWidget::DrawChildren | QWidget::IgnoreMask);
+
QRect r(rect);
if (r.width() < 0)
r.setWidth(widget->width() - rect.x());
@@ -1086,8 +1089,8 @@ QPixmap QPixmap::grabWidget(QWidget * widget, const QRect &rect)
return QPixmap();
QPixmap res(r.size());
- widget->render(&res, QPoint(), r,
- QWidget::DrawWindowBackground | QWidget::DrawChildren | QWidget::IgnoreMask);
+ widget->d_func()->render(&res, QPoint(), r, QWidget::DrawWindowBackground
+ | QWidget::DrawChildren | QWidget::IgnoreMask, true);
return res;
}