| Summary: | ECMInstallIcons doesn't generate index.theme, rendering installed themes unreadable by Qt | ||
|---|---|---|---|
| Product: | [Frameworks and Libraries] extra-cmake-modules | Reporter: | Dawid Wróbel <me> |
| Component: | general | Assignee: | ecm-bugs-null <ecm-bugs-null> |
| Status: | REPORTED --- | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | 5.68.0 | ||
| Target Milestone: | --- | ||
| Platform: | Ubuntu | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
(my apologies, obviously meant index.theme whenever I said index.html. Muscle memory.) Unless I'm missing something, this is the expected behaviour. ECMInstallIcons is not only used for full icon sets but also for applications. The index.theme file is installed by the icon themes repository, eg: - Breeze: https://invent.kde.org/frameworks/breeze-icons/-/blob/master/icons/index.theme - Oxygen: https://invent.kde.org/frameworks/oxygen-icons5/-/blob/master/index.theme What I am trying to do is to install additional icons that would compliment the existing theme. In this case we're talking about finance-specific breeze icons. Installing them to /usr/local/share/kmymoney/icons/breeze has no effect, despite having added that location to QIcon::themeSearchPaths():
ecm_install_icons(
ICONS ${KMYMONEY_BREEZE_ICONS}
DESTINATION ${DATA_INSTALL_DIR}/kmymoney/icons
THEME "breeze"
)
This is because the index.theme that system-provided breeze icon set comes with is defined as
(...)
[actions/24]
[actions/32]
[actions/64]
(...)
, however, ecm_install_icons copies them to an incompatible folder structure:
"(...) The above code will install the file ``22-actions-menu_new.png`` as
``${CMAKE_INSTALL_PREFIX}/share/icons/<theme>/22x22/actions/menu_new.png``"
The "22x22/actions" structure is compatible with e.g. oxygen's index.theme:
"(...)
[32x32/actions]
Size=32
Context=Actions
Type=Threshold
[32x32/animations]
Size=32
Context=Animations
Type=Threshold
[32x32/apps]
Size=32
Context=Applications
Type=Threshold"
In other words, ecm_install_icons assumes arbitrary folder scheme which themes seem to deviate from.
|
SUMMARY ECMInstallIcons documentation doesn't mention anything about the index.html, giving an impression that preparing icons according to the pattern (<size>-<group>-<name>.<ext>) is the only thing required for the icons to be "installed to the appropriate subdirectory of DESTINATION according to the FreeDesktop.org icon naming scheme." However, icons installed this way will not work, since QIconTheme will mark such theme as invalid (!isValid()), unless the files are being copied to an location that already contains a valid theme. One could obviously prepare an index.html by hand, but since ECMInstallIcons builds out final theme folder structure automatically, predicting it ahead of time is futile and negates the whole purpose of the automation. STEPS TO REPRODUCE 1. Add a folder with icons matching the <size>-<group>-<name>.<ext> pattern 2. add a CMakeList and configure a "fallback_theme" according to ECMInstallIcons requirements 3. observe the files copied to a requested location, but without index.theme file 4. use setFallbackTheme("fallback_theme") upon initialization. OBSERVED RESULT Icons are not getting loaded despite fallbackThemeName() returning correct theme name and theme icons physically present at the location. EXPECTED RESULT a) ECMInstallIcons to generate a bare minimum index.theme file b) ECMInstallIcons documentation to mention that index.theme is required by QT, effectively requiring that the file is prepared by hand or that the functioning theme must already be present at the DESTINATION and that the ECMInstallIcons is meant for installing additional icons only. Qt Version: 5.12.8