SUMMARY When using QT_QUICK_CONTROLS_STYLE=org.kde.desktop, Kirigami global drawer and buttons fail to load icons specified by name and available in the fallback path. For example, if an application has some specific icons, its impossible to load them as a part of global drawer (menu action) or as an action button on toolbar. At the same time, the same icon loads fine using IconImage of QML (from qc2 private). STEPS TO REPRODUCE 1. design and position an icon with a unique name in some fallback folder 2. add this folder into the part using QIcon::setFallbackSearchPaths 3. observe that icon is not shown in globalDrawer, buttons, but is shown fine if loaded using IconImage All works fine with Plasma or Material set as a style using QT_QUICK_CONTROLS_STYLE SOFTWARE/OS VERSIONS Linux/KDE Plasma: gentoo; same holds for current flathub platform (available in About System) KDE Plasma Version: KDE Frameworks Version: 5.56; kirigami 5.56 or git master Qt Version: 5.11 and 5.12 ADDITIONAL INFORMATION
From discussions on Kirigami IRC, it seemed that the issue is probably in KIconLoader. In particular, it seems that KIconLoader ignores fallback path set by QIcon::setFallbackSearchPaths call. In my application, problem is evident only in QT_QUICK_CONTROLS_STYLE=org.kde.desktop with all other styles, including Plasma, working as expected. Hence the move to the frameworks-kiconthemes product.
Maybe that is the reason ? Does it mean kde doesn't use the pathes set with QIcon::setThemeSearchPaths ? https://cgit.kde.org/kiconthemes.git/tree/src/kicontheme.cpp#n289 // local embedded icons have preference icnlibs << QStringLiteral(":/icons");
Git commit 19d2ec41fef106de5d60adacbb43f22a90ff6c1b by Nicolas Fella. Committed on 13/06/2020 at 22:30. Pushed by nicolasfella into branch 'master'. Respect QIcon::fallbackSearchpaths() Summary: When an icon isn't found within a theme we are supposed to look for it in QIcon::fallbackSearchpaths() (https://doc.qt.io/qt-5/qicon.html#fromTheme). Test Plan: Create /home/nico/foo.svg Add QIcon::setFallbackSearchPaths(QIcon::fallbackSearchPaths() << QStringLiteral("/home/nico/myicons")); to my app Use foo icon somewhere Reviewers: #plasma, #frameworks, mart Reviewed By: #plasma, mart Subscribers: mart, kossebau, aacid, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D29390 M +17 -0 src/kiconloader.cpp https://invent.kde.org/frameworks/kiconthemes/commit/19d2ec41fef106de5d60adacbb43f22a90ff6c1b