diff options
author | Andy Shaw <andy.shaw@qt.io> | 2016-08-05 14:43:15 +0200 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2016-08-30 12:48:14 +0000 |
commit | 2ca4fd401b90831857a0dcd643e5d382feb75cb0 (patch) | |
tree | e741c610819d3fbedd97ffee093e30a61d274dd0 | |
parent | 579283507c392fc5bc0976c054304ecb8938cb06 (diff) |
QIcon: Set the pixmap's dpr to 1.0 if the window is also set to 1.0
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 <morten.sorvig@qt.io>
-rw-r--r-- | src/gui/image/qicon.cpp | 7 |
1 files 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); |