lxqt / libqtxdg

Qt implementation of freedesktop.org xdg specs
https://lxqt.github.io
GNU Lesser General Public License v2.1
72 stars 35 forks source link

XdgIconLoader ignores QIcon::fallbackSearchPaths() #258

Closed maxrd2 closed 2 years ago

maxrd2 commented 3 years ago

QIcon::fallbackSearchPaths() was added in Qt 5.11

Expected Behavior

When QIcon::fromTheme("some_icon") fails to find "some_icon" in theme search paths QIcon::themeSearchPaths() it's supposed to find non-themed icon from QIcon::fallbackSearchPaths().

Current Behavior

When QT_QPA_PLATFORMTHEME is set to lxqt (I think XdgIconLoader is used as icon engine) fallback icon search paths are ignored. If QIcon::fromTheme("some_icon") fails to find "some_icon" in theme search paths it won't load/return any icon.

Possible Solution

Consider QIcon::fallbackSearchPaths() when searching for fallback icons before using other fallback methods.

Steps to Reproduce (for bugs)

n/a

Context

https://invent.kde.org/multimedia/subtitlecomposer/commit/656b919790761af346a2ef44bfd8eface404164d

System Information
tsujan commented 3 years ago

LXQt follows freedesktop.org Icon Theme Specification (with a small modification). The inheritance of an icon theme is independent of the platform, let alone Qt.

Do you know of any freedesktop.org standard about this?

tsujan commented 3 years ago

OK, I checked Qt's code: QIcon::setFallbackSearchPaths() just adds a Qt-specific path, ignoring freedesktop standards..

I, for one, have no problem with adding QIcon::fallbackSearchPaths() after the standard fallback paths but it seems quite weird to me.

@luis-pereira, what do you think?

maxrd2 commented 3 years ago

I don't think it's part of any standard, just how Qt5 APIs handle icon fallbacks. Since LXQt has it's own Qt5 icon engine plugin thought to just bring it to your attention.

tsujan commented 3 years ago

OK, thanks!

I wonder why, on the one hand, Qt leaves the effect of QIcon::setFallbackSearchPaths() (or the lack of it) to the platform's implementation and, on the other hand, it allows overriding of QPlatformTheme::IconFallbackSearchPaths by the app! It doesn't look self-consistent.