XDG Icon Theme Specification 0.13 resolver.
More...
#include <PhosphorServiceIconTheme/IconThemeResolver.h>
|
| void | setThemeName (const QString &themeName) |
| | Force a theme override.
|
| QString | themeName () const |
| QImage | iconForName (const QString &name, int size, int scale=1, const QString &extraThemeDir={}) const |
| | Look up an icon by name.
|
|
| static IconThemeResolver * | instance () |
| | Process-wide singleton. Created lazily on first call.
|
| static QImage | decodePixmaps (const QList< QPair< QSize, QByteArray > > &pixmaps, int size) |
| | Bypass theme lookup and decode a raw IconPixmap byte stream straight off the wire (ARGB32 in network byte order).
|
XDG Icon Theme Specification 0.13 resolver.
https://specifications.freedesktop.org/icon-theme-spec/latest/
Singleton because the parsed theme index is expensive to build (walking /usr/share/icons/* parses dozens of index.theme files) and the same theme tree is reused across every tray item. iconForName() returns the best-match QImage by walking the active theme + inherited parents + Hicolor fallback, using the spec's distance algorithm to pick a size when no exact match exists.
◆ decodePixmaps()
| QImage PhosphorServiceIconTheme::IconThemeResolver::decodePixmaps |
( |
const QList< QPair< QSize, QByteArray > > & | pixmaps, |
|
|
int | size ) |
|
staticnodiscard |
Bypass theme lookup and decode a raw IconPixmap byte stream straight off the wire (ARGB32 in network byte order).
Picks the pixmap closest to size from the list and converts.
◆ iconForName()
| QImage PhosphorServiceIconTheme::IconThemeResolver::iconForName |
( |
const QString & | name, |
|
|
int | size, |
|
|
int | scale = 1, |
|
|
const QString & | extraThemeDir = {} ) const |
|
nodiscard |
Look up an icon by name.
extraThemeDir is the SNI item's IconThemePath (if any); when set, it is probed as a flat directory containing raw <name>.{png,svg,xpm} files BEFORE the themed walk runs, matching the SNI convention that most apps dump custom icons straight into the override dir rather than a themed NN/context subtree. Unsafe paths (.., NUL, \\, /../ patterns) are rejected at the boundary; safe paths must be absolute. size is the desired logical-pixel size; scale is the device pixel ratio (1 for traditional, 2 for HiDPI). Returns an empty QImage when no match exists, when name is empty, or when either size or scale is non-positive.
◆ instance()
| IconThemeResolver * PhosphorServiceIconTheme::IconThemeResolver::instance |
( |
| ) |
|
|
static |
Process-wide singleton. Created lazily on first call.
◆ setThemeName()
| void PhosphorServiceIconTheme::IconThemeResolver::setThemeName |
( |
const QString & | themeName | ) |
|
Force a theme override.
Empty string => fall back to detection via QIcon::themeName(), which the Qt platform plugin sources from Plasma, GTK, or xsettings as available.
◆ themeChanged
| void PhosphorServiceIconTheme::IconThemeResolver::themeChanged |
( |
| ) |
|
|
signal |
◆ themeName()
| QString PhosphorServiceIconTheme::IconThemeResolver::themeName |
( |
| ) |
const |
|
nodiscard |
The documentation for this class was generated from the following file: