Bug 365130 - QIcon::themeIcon(icon)) always returns default icon
Summary: QIcon::themeIcon(icon)) always returns default icon
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kiconthemes
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.23.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Christoph Feck
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-05 22:44 UTC by Olivier Churlaud
Modified: 2016-07-12 07:55 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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