Bug 330845 - Icon loader (QIcon::fromTheme et all) no longer tries to use nearest available size when asked for size not installed on the system
Summary: Icon loader (QIcon::fromTheme et all) no longer tries to use nearest availabl...
Alias: None
Product: frameworks-kiconthemes
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Christoph Feck
: 334332 (view as bug list)
Depends on:
Reported: 2014-02-06 10:50 UTC by Bhushan Shah
Modified: 2014-05-30 10:55 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Bhushan Shah 2014-02-06 10:50:38 UTC
This problem appears in Plasma, where some icons are replaced by "unknown" icon. When I try to re size icon to smaller size, it appears back again. So problem is it returns unknown icon instead of largest available icon.

Reproducible: Always

Steps to Reproduce:
1. If you have kde-workspace and plasmoidviewer installed,
2. plasmoidviewer -a org.kde.plasma.showActivityManager
3. Resize applet to smaller size
Actual Results:  
At start icon does not appear, but when you resize applet icon appears.

Expected Results:  
Icon should also appear at start
Comment 1 Eike Hein 2014-05-05 12:36:41 UTC
*** Bug 334332 has been marked as a duplicate of this bug. ***
Comment 2 Eike Hein 2014-05-05 12:37:07 UTC
I'm running into the same problem in Application Menu (aka Kicker): I have a QML delegate using QIconItem backed by a model supplying QIcons created  via QIcon::fromTheme(<icon name>). The delegate uses 16x16 icons on a standard DPI system. If an app doesn't have a 16x16 icon installed, QIconItem winds up showing the "unknown" placeholder. In KDE 4, it would scale down from the available 24x24 icon instead. See bug 334332 for more.
Comment 3 David Faure 2014-05-06 22:02:34 UTC
Should be reported to Qt with a testcase...
Comment 4 David Faure 2014-05-06 22:04:02 UTC
Quoting the QIcon documentation: 
"The default engine scales pixmaps down if required, [...]"

So this is a bug, AFAICS, not a missing feature.
Comment 5 Martin Klapetek 2014-05-30 10:55:41 UTC
Git commit aa0035d0a69e84c053f6b4504e479fc14ef1cdd2 by Martin Klapetek.
Committed on 30/05/2014 at 10:55.
Pushed by mklapetek into branch 'master'.

Fix looking up icons

What the current code does is looking for the best match, storing it
into QString path...and then overwrite it with empty string on next run
if the icon is not found in the current dir. So we need to check first
if the icon is available in the theme and only then store the path,
otherwise empty string gets returned non-deterministically.

This also fixes case of some missing icons in Plasma Next.

REVIEW: 118415

M  +6    -2    src/kicontheme.cpp