From 896c4fe4279f7dc761dcd59f7b0cde070c38b3cb Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 19 Apr 2024 20:52:19 +0200 Subject: QStyleHelper: pass devicePixelRatio to uniqueName() QStyleHelper::uniqueName() took the size of the pixmap to cache but not the dpr. This might lead to a situation (e.g. in a multi-display environment) where we use a pixmap with the wrong dpr and get a pixelated result on the screen. Change-Id: Ifdebeddff3380931398b3284a7757b7da950caa9 Reviewed-by: Axel Spoerl Reviewed-by: Wladimir Leuschner --- src/widgets/styles/qstylehelper.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/widgets/styles/qstylehelper.cpp') diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp index 1084761d30..02827de847 100644 --- a/src/widgets/styles/qstylehelper.cpp +++ b/src/widgets/styles/qstylehelper.cpp @@ -32,7 +32,7 @@ static inline bool usePixmapCache(const QStyleOption *opt) return true; } -QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size) +QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size, qreal dpr) { if (!usePixmapCache(option)) return {}; @@ -43,7 +43,8 @@ QString uniqueName(const QString &key, const QStyleOption *option, const QSize & % HexString(complexOption ? uint(complexOption->activeSubControls) : 0u) % HexString(option->palette.cacheKey()) % HexString(size.width()) - % HexString(size.height()); + % HexString(size.height()) + % HexString(dpr); #if QT_CONFIG(spinbox) if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast(option)) { -- cgit v1.2.3