summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2020-09-11 15:57:10 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2020-09-18 04:49:58 +0200
commitab75227c10675fc8c7a0885683eb0f6a4d53eb6e (patch)
tree68439f59074ac6050fcb12d5deb948ee8b1a3d17
parent3983afd48f27cdbb006720957ff34cf58f126ca5 (diff)
Fix deprecation warning in QIcon::actualSize()
The non-deprecated one called the deprecated one :-( Inline the deprecated one and simplify, given the null pointer passed down. Change-Id: I5b99053357fc3be109e61ccf1161835bf527b686 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
-rw-r--r--src/gui/image/qicon.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index e0af130d13..826627359d 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Copyright (C) 2015 Olivier Goffart <ogoffart@woboq.com>
** Contact: https://www.qt.io/licensing/
**
@@ -894,7 +894,15 @@ QSize QIcon::actualSize(const QSize &size, Mode mode, State state) const
{
if (!d)
return QSize();
- return actualSize(nullptr, size, mode, state);
+
+ const qreal devicePixelRatio = qApp->devicePixelRatio();
+
+ // Handle the simple normal-dpi case:
+ if (!(devicePixelRatio > 1.0))
+ return d->engine->actualSize(size, mode, state);
+
+ const QSize actualSize = d->engine->actualSize(size * devicePixelRatio, mode, state);
+ return actualSize / d->pixmapDevicePixelRatio(devicePixelRatio, size, actualSize);
}
/*!