Bug 365130

Summary: QIcon::themeIcon(icon)) always returns default icon
Product: [Frameworks and Libraries] frameworks-kiconthemes Reporter: Olivier Churlaud <olivier>
Component: generalAssignee: Christoph Feck <cfeck>
Status: RESOLVED FIXED    
Severity: normal CC: kdelibs-bugs
Priority: NOR    
Version: 5.23.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Olivier Churlaud 2016-07-05 22:44:12 UTC
I'm not sure it goes here, please move it if needed.

I was using TexStudio and I realized almost all icons were replaced by a default breeze empty icon. I bisected the issue and found out that QIcon::hasThemeIcon(icon)) always returns true and that QIcon::themeIcon(icon))  returns an empty breeze icon if the icon doesn't exist. instead of a null object.

See https://sourceforge.net/p/texstudio/bugs/1837/

Reproducible: Always
Comment 1 Olivier Churlaud 2016-07-05 22:44:52 UTC
It might be a Qt issue, but I cannot test without plasma.
Comment 2 David Rosca 2016-07-12 07:55:12 UTC
Git commit 0abf1b7a148cf6b27caea01a329631e0f1daa983 by David Rosca.
Committed on 12/07/2016 at 07:54.
Pushed by drosca into branch 'master'.

KIconEngine: Fix QIcon::hasThemeIcon always returning true

QIcon::hasThemeIcon(name) checks if QIcon::name() == name,
so icon engine must return empty string when icon doesn't exist.
Also implement IsNullHook for Qt 5.7. Comes with autotest.

REVIEW: 128397

M  +1    -0    autotests/CMakeLists.txt
A  +75   -0    autotests/kiconengine_unittest.cpp     [License: LGPL (v2+)]
M  +15   -0    src/kiconengine.cpp
M  +2    -0    src/kiconengine.h

http://commits.kde.org/kiconthemes/0abf1b7a148cf6b27caea01a329631e0f1daa983