From c5c6df40bee57cc28427d36b4c7c6860ae14b722 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 26 Mar 2025 20:10:40 +0100 Subject: [PATCH] QIconLoaderEngine: use scaledPixmap() to properly pass dpr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QIconLoaderEngine::paint() was still using QIconLoader::pixmap() to retrieve the pixmap for painting instead QIconLoader::scaledPixmap() which takes the devicePixelRatio as additional parameter. In the case of icon themes this could pick up the wrong pixmap (from the wrong folder). Pick-to: 6.9 6.8 Fixes: QTBUG-135159 Change-Id: I69ceada35f36c64675c4147cf284a180a4c69915 Reviewed-by: Morten Johan Sørvig --- src/gui/image/qiconloader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index ef69a3ade34..65785c406c2 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -798,8 +798,8 @@ bool QIconLoaderEngine::hasIcon() const void QIconLoaderEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) { - QSize pixmapSize = rect.size() * painter->device()->devicePixelRatio(); - painter->drawPixmap(rect, pixmap(pixmapSize, mode, state)); + const auto dpr = painter->device()->devicePixelRatio(); + painter->drawPixmap(rect, scaledPixmap(rect.size(), mode, state, dpr)); } /*