Bug 436637

Summary: KIconLoader does not respect QIcon::themeSearchPaths()
Product: [Frameworks and Libraries] frameworks-kiconthemes Reporter: Nicolas Fella <nicolas.fella>
Component: generalAssignee: Christoph Feck <cfeck>
Status: REPORTED ---    
Severity: normal CC: a.samirh78, kdelibs-bugs-null
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Nicolas Fella 2021-05-05 15:07:33 UTC
STEPS TO REPRODUCE
1. Install some icons to e.g. /usr/share/foo/icons/hicolor/22x22/actions/bla.png
2. Call QIcon::setThemeSearchPaths(QIcon::themeSearchPaths() << "/usr/share/foo/icons/");
2. Use QIcon::fromTheme("bla") on Plasma

OBSERVED RESULT
foo is not found

EXPECTED RESULT
foo is found

Forcing the app to use another icon loader via QT_QPA_PLATFORMTHEME=gtk3 makes the icon work


SOFTWARE/OS VERSIONS
KDE Plasma Version: master
KDE Frameworks Version: master
Qt Version: 5.15-kde
Comment 1 Ahmad Samir 2022-06-12 18:52:51 UTC
Seems to work here; I test with qtcreator:

    QIcon::setThemeSearchPaths(QIcon::themeSearchPaths() << "/usr/share/yelp/icons");
    QIcon icon = QIcon::fromTheme("yelp-page-task");
    qDebug() << icon << QIcon::themeSearchPaths();

QIcon("yelp-page-task",availableSizes[normal,Off]=QList(QSize(16, 16)),cacheKey=0x100000000) QList("/home/ahmad/.icons", "/home/ahmad/.local/share/icons", "/usr/local/share/icons", "/usr/share/icons", ":/icons", "/usr/share/yelp/icons")