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
QPixmap KStandardItemListWidget::pixmapForIcon(const QString& name, const QStringList& overlays, int size)
{
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)) {
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) {
int requestedSize;
if (size <= KIconLoader::SizeSmall) {