From ab75227c10675fc8c7a0885683eb0f6a4d53eb6e Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 11 Sep 2020 15:57:10 +0200 Subject: Fix deprecation warning in QIcon::actualSize() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/gui/image/qicon.cpp | 12 ++++++++++-- 1 file 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 ** 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); } /*! -- cgit v1.2.3