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).
BUG: 405522
mart |
Plasma | |
Frameworks |
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).
BUG: 405522
Create /home/nico/foo.svg
Add QIcon::setFallbackSearchPaths(QIcon::fallbackSearchPaths() << QStringLiteral("/home/nico/myicons")); to my app
Use foo icon somewhere
No Linters Available |
No Unit Test Coverage |
Buildable 26743 | |
Build 26761: arc lint + arc unit |
src/kiconloader.cpp | ||
---|---|---|
1142 | Would it make sense trying to use QIconLoader::lookupFallbackIcon ? This way we "upstream" Qt behaviour? For example you're supporting svgz while Qt doesn't. Which would mean different QIcon::fallbackSearchPaths whether you're using KIconLoader or not which doesn't seem totally great? |
src/kiconloader.cpp | ||
---|---|---|
1142 | I just realized that function is private, not really easy to use :/ anyhow do you think we should remove svgz? Also i think using const QStringList extensions = { QStringLiteral(".png"), QStringLiteral(".svg"), QStringLiteral(".svgz"), QStringLiteral(".xpm") }; should be a bit faster |
src/kiconloader.cpp | ||
---|---|---|
1142 | You could make this even a stack-only array, even more fast due to no heap alloc ;) const QString extensions[] = { QStringLiteral(".png"), QStringLiteral(".svg"), QStringLiteral(".svgz") << QStringLiteral(".xpm" }; |
src/kiconloader.cpp | ||
---|---|---|
1142 | I copied that list from somewhere else in KIconLoader. It would seem weird to me to support a different set of formats in the fallback than in the regular path |