QIconLoaderEngine: use scaledPixmap() to properly pass dpr

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.8
Fixes: QTBUG-135159
Change-Id: I69ceada35f36c64675c4147cf284a180a4c69915
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit c5c6df40bee57cc28427d36b4c7c6860ae14b722)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Christian Ehrlicher 2025-03-26 20:10:40 +01:00 committed by Qt Cherry-pick Bot
parent ea47e479a2
commit 0a8737901e

View File

@ -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));
}
/*