From 3f53670cc23392b298ca9cb2b52d8ac31dfcb5c9 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Fri, 9 Jan 2026 15:22:38 +0200 Subject: [PATCH] fix jpg icons fixes #4686 and fixes #4666 Forces jpg and jpeg to go through QPixmap first then to Icon. The original behaivior used the QIcon internal engine to build the QPixmap causing some inconsitencies. Signed-off-by: Trial97 --- launcher/icons/IconList.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/launcher/icons/IconList.cpp b/launcher/icons/IconList.cpp index fb80f89da..6c26ddf57 100644 --- a/launcher/icons/IconList.cpp +++ b/launcher/icons/IconList.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include "icons/IconUtils.h" @@ -217,7 +218,13 @@ void IconList::fileChanged(const QString& path) int idx = getIconIndex(key); if (idx == -1) return; - QIcon icon(path); + QIcon icon; + // special handling for jpg and jpeg to go through pixmap to keep the size constant + if (path.endsWith(".jpg") || path.endsWith(".jpeg")) { + icon.addPixmap(QPixmap(path)); + } else { + icon.addFile(path); + } if (icon.availableSizes().empty()) return; @@ -395,7 +402,14 @@ bool IconList::addThemeIcon(const QString& key) bool IconList::addIcon(const QString& key, const QString& name, const QString& path, const IconType type) { // replace the icon even? is the input valid? - QIcon icon(path); + QIcon icon; + // special handling for jpg and jpeg to go through pixmap to keep the size constant + if (path.endsWith(".jpg") || path.endsWith(".jpeg")) { + icon.addPixmap(QPixmap(path)); + } else { + icon.addFile(path); + } + if (icon.isNull()) return false; auto iter = m_nameIndex.find(key);