summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qicon.cpp
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-08-29 22:28:34 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-08-31 14:29:01 +0200
commit2dc46c09026362cc267b1183faf09fb29479ef93 (patch)
tree7da9a47745e2fdb213ffa5830f4c867c0c25cd61 /src/gui/image/qicon.cpp
parent8adb0dde1984438d52de4bcb610e4139558bd1a0 (diff)
Deprecate and remove all uses of AA_UseHighDpiPixmaps
High-DPI pixmaps are always enabled, and cannot be disabled. Change-Id: I01a006b404e5431582b64ef812974c1c022b39ae Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui/image/qicon.cpp')
-rw-r--r--src/gui/image/qicon.cpp34
1 files changed, 8 insertions, 26 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index a4f6369fd2..2278eb8201 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -128,15 +128,9 @@ static void qt_cleanup_icon_cache()
Returns the effective device pixel ratio, using
the provided window pointer if possible.
-
- if Qt::AA_UseHighDpiPixmaps is not set this function
- returns 1.0 to keep non-hihdpi aware code working.
*/
static qreal qt_effective_device_pixel_ratio(QWindow *window = nullptr)
{
- if (!qApp->testAttribute(Qt::AA_UseHighDpiPixmaps))
- return qreal(1.0);
-
if (window)
return window->devicePixelRatio();
@@ -190,11 +184,8 @@ QPixmapIconEngine::~QPixmapIconEngine()
void QPixmapIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state)
{
- qreal dpr = 1.0;
- if (QCoreApplication::testAttribute(Qt::AA_UseHighDpiPixmaps)) {
- auto paintDevice = painter->device();
- dpr = paintDevice ? paintDevice->devicePixelRatioF() : qApp->devicePixelRatio();
- }
+ auto paintDevice = painter->device();
+ qreal dpr = paintDevice ? paintDevice->devicePixelRatioF() : qApp->devicePixelRatio();
const QSize pixmapSize = rect.size() * dpr;
QPixmap px = pixmap(pixmapSize, mode, state);
painter->drawPixmap(rect, px);
@@ -800,11 +791,8 @@ qint64 QIcon::cacheKey() const
/*!
Returns a pixmap with the requested \a size, \a mode, and \a
state, generating one if necessary. The pixmap might be smaller than
- requested, but never larger.
-
- Setting the Qt::AA_UseHighDpiPixmaps application attribute enables this
- function to return pixmaps that are larger than the requested size. Such
- images will have a devicePixelRatio larger than 1.
+ requested, but never larger, unless the device-pixel ratio of the returned
+ pixmap is larger than 1.
\sa actualSize(), paint()
*/
@@ -822,11 +810,8 @@ QPixmap QIcon::pixmap(const QSize &size, Mode mode, State state) const
\overload
Returns a pixmap of size QSize(\a w, \a h). The pixmap might be smaller than
- requested, but never larger.
-
- Setting the Qt::AA_UseHighDpiPixmaps application attribute enables this
- function to return pixmaps that are larger than the requested size. Such
- images will have a devicePixelRatio larger than 1.
+ requested, but never larger, unless the device-pixel ratio of the returned
+ pixmap is larger than 1.
*/
/*!
@@ -835,11 +820,8 @@ QPixmap QIcon::pixmap(const QSize &size, Mode mode, State state) const
\overload
Returns a pixmap of size QSize(\a extent, \a extent). The pixmap might be smaller
- than requested, but never larger.
-
- Setting the Qt::AA_UseHighDpiPixmaps application attribute enables this
- function to return pixmaps that are larger than the requested size. Such
- images will have a devicePixelRatio larger than 1.
+ than requested, but never larger, unless the device-pixel ratio of the returned
+ pixmap is larger than 1.
*/
/*!