XDG Icon Theme Specification 0.13 resolver. More...
#include <phosphor-services/include/PhosphorServices/IconThemeResolver.h>
Signals | |
| void | themeChanged () |
Public Member Functions | |
| 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 Public Member Functions | |
| 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.
|
static |
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.
| QImage PhosphorServices::IconThemeResolver::iconForName | ( | const QString & | name, |
| int | size, | ||
| int | scale = 1, |
||
| const QString & | extraThemeDir = {} |
||
| ) | const |
Look up an icon by name.
extraThemeDir is the SNI item's IconThemePath (if any) — when set, it's prepended to the search path so an app's custom theme wins over the system one. 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.
|
static |
Process-wide singleton. Created lazily on first call.
| void PhosphorServices::IconThemeResolver::setThemeName | ( | const QString & | themeName | ) |
Force a theme override.
Empty string => fall back to detection from Qt's icon theme name + GTK env hints.
|
signal |
| QString PhosphorServices::IconThemeResolver::themeName | ( | ) | const |