diff options
author | Timur Pocheptsov <Timur.Pocheptsov@digia.com> | 2014-10-21 18:23:16 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@theqtcompany.com> | 2015-03-23 08:05:25 +0000 |
commit | 615dc2294a7b12344e3e88cde481326c9e94c279 (patch) | |
tree | fa2b2964c814a8e89b3bce067016d717eb78d323 /src/widgets | |
parent | 7cb2235fd44fa247cc19f3826def23e93b653e89 (diff) |
QWidget: render() in correct resolution on retina
Factor in the target devicePixelRatio when setting
the size (and devicePixelRatio) on the target pixmap.
Task-number: QTBUG-41682
Change-Id: I16a85cf7ba0adb6d6c05e9de4fd44ff5533b5f60
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 559e4ae43f..e1053b4add 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5352,7 +5352,10 @@ void QWidgetPrivate::render_helper(QPainter *painter, const QPoint &targetOffset if (size.isNull()) return; - QPixmap pixmap(size); + const qreal pixmapDevicePixelRatio = qreal(painter->device()->devicePixelRatio()); + QPixmap pixmap(size * pixmapDevicePixelRatio); + pixmap.setDevicePixelRatio(pixmapDevicePixelRatio); + if (!(renderFlags & QWidget::DrawWindowBackground) || !isOpaque) pixmap.fill(Qt::transparent); q->render(&pixmap, QPoint(), toBePainted, renderFlags); |