40 lines
1.4 KiB
Diff
40 lines
1.4 KiB
Diff
|
From: Wolfgang Bauer <wbauer@tmo.at>
|
||
|
Date: Tue, 26 Apr 2016 14:11:26 +0000
|
||
|
Subject: Specify a fallback icon to QIcon::fromTheme()
|
||
|
X-Git-Url: http://quickgit.kde.org/?p=dolphin.git&a=commitdiff&h=44d4d2ea715719a08c639541530a5b330647297d
|
||
|
---
|
||
|
Specify a fallback icon to QIcon::fromTheme()
|
||
|
|
||
|
The default fallback of QIcon::fromTheme() is QIcon(), i.e. a null icon.
|
||
|
Set the generic "unknown" icon as fallback to prevent missing icons for
|
||
|
filetypes that specify an icon name that doesn't exist.
|
||
|
|
||
|
This also gets rid of "QPixmap::scaled: Pixmap is a null pixmap"
|
||
|
warnings in that case.
|
||
|
|
||
|
BUG: 358958
|
||
|
BUG: 361034
|
||
|
FIXED-IN: 16.04.1
|
||
|
REVIEW: 127713
|
||
|
---
|
||
|
|
||
|
|
||
|
--- a/src/kitemviews/kstandarditemlistwidget.cpp
|
||
|
+++ b/src/kitemviews/kstandarditemlistwidget.cpp
|
||
|
@@ -1440,12 +1440,13 @@
|
||
|
|
||
|
QPixmap KStandardItemListWidget::pixmapForIcon(const QString& name, const QStringList& overlays, int size)
|
||
|
{
|
||
|
+ static const QIcon fallbackIcon = QIcon::fromTheme(QStringLiteral("unknown"));
|
||
|
size *= qApp->devicePixelRatio();
|
||
|
const QString key = "KStandardItemListWidget:" % name % ":" % overlays.join(QStringLiteral(":")) % ":" % QString::number(size);
|
||
|
QPixmap pixmap;
|
||
|
|
||
|
if (!QPixmapCache::find(key, pixmap)) {
|
||
|
- const QIcon icon = QIcon::fromTheme(name);
|
||
|
+ const QIcon icon = QIcon::fromTheme(name, fallbackIcon);
|
||
|
|
||
|
int requestedSize;
|
||
|
if (size <= KIconLoader::SizeSmall) {
|
||
|
|