mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
[Backport release-10.x] fix jpg icons (#4714)
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.
(cherry picked from commit 3f53670cc2)
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Co-authored-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
0d32167303
commit
185d5cb4bb
1 changed files with 16 additions and 2 deletions
|
|
@ -40,6 +40,7 @@
|
|||
#include <QFileSystemWatcher>
|
||||
#include <QMap>
|
||||
#include <QMimeData>
|
||||
#include <QPixmap>
|
||||
#include <QSet>
|
||||
#include <QUrl>
|
||||
#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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue