From 2ca4fd401b90831857a0dcd643e5d382feb75cb0 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 5 Aug 2016 14:43:15 +0200 Subject: QIcon: Set the pixmap's dpr to 1.0 if the window is also set to 1.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the pixmap is initially from a higher device pixel ratio and it is being used on a window that does not have a device pixel ratio other than 1.0 set then the pixmap should also have it set to 1.0. This ensures that the size of the pixmap is preserved and it is not scaled down as a result on the normal display. Change-Id: Ie5d96b3e1508867b723000bea182c8157640af02 Reviewed-by: Morten Johan Sørvig --- src/gui/image/qicon.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index e1e5367766..3531be412e 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -835,8 +835,11 @@ QPixmap QIcon::pixmap(QWindow *window, const QSize &size, Mode mode, State state qreal devicePixelRatio = qt_effective_device_pixel_ratio(window); // Handle the simple normal-dpi case: - if (!(devicePixelRatio > 1.0)) - return d->engine->pixmap(size, mode, state); + if (!(devicePixelRatio > 1.0)) { + QPixmap pixmap = d->engine->pixmap(size, mode, state); + pixmap.setDevicePixelRatio(1.0); + return pixmap; + } // Try get a pixmap that is big enough to be displayed at device pixel resolution. QPixmap pixmap = d->engine->pixmap(size * devicePixelRatio, mode, state); -- cgit v1.2.3