KIconEngine is used by frameworkintegration to provide a platform specific QIconEngine. Unfortunately a feature of KIconEngine breaks QIcon::hasThemeIcon. By always rendering the "unknown" icon the checks performed by QIcon::hasThemeIcon fail as it compares against a null QIcon. Also the fallback icon from QIcon::fromTheme is never picked. It is unexpected that using a platform theme breaks the API of QIcon. Also it breaks the fallback handling in KWindowSystem::icon. Reproducible: Always Steps to Reproduce: 1. Use kwin 2. Use Xephyr Actual Results: Window decoration of Xephyr doesn't pick the xorg fallback icon, but a "missing icon" icon Expected Results: Window decoration of Xephyr doesn't pick the xorg fallback icon
Additional info: QIcon::hasThemeIcon compares for QIcon::isNull while QIcon::fromTheme checks the availableSizes to determine whether the fallback icon should be returned.
So how can this be fixed? If QIcon::fromTheme needs to return a null icon for QIcon::hasThemeIcon to fail correctly, then QIcon::fromTheme cannot return a fallback icon. Or did I miss something?
Hi, indeed this looks a bit strange here is the check for hasThemeIcon: https://qt.gitorious.org/qt/qtbase/source/73a1e8c60d894701f34806cc4b847aa2814bf389:src/gui/image/qicon.cpp#L1198-1203 and this the used fromTheme function: https://qt.gitorious.org/qt/qtbase/source/73a1e8c60d894701f34806cc4b847aa2814bf389:src/gui/image/qicon.cpp#L1167-1188 So as the hasThemeIcon function calls fromTheme with no fallback the Null Icon should be returned if the theme has no icon for the given name (availableSizes.isEmpty). So to fix this "KDE" should not report available sizes for icons that are definitely not in the current theme. I'm not sure this is fixable on the qt side as they rely on the platform theme implementation. I guess this whole QPA stuff moves a lot of responsibility to the KDE devs ;).
QIcon::fromTheme need to return a fallback icon only if the fallback is passed as parametter. what that means is that means is that the returned icon by the custom engine from the platform theme must be emtpy.
My attempt: https://reviewboard.kde.org/r/122608/
Fixed by http://commits.kde.org/kiconthemes/b0a6df6fbd9117b41a7f4e3bc861e20fbadb1956