YODAU 1.0
YEAR OF THE DEPEND ADULT UNDERGARMENT
Loading...
Searching...
No Matches
icon_loader Class Reference

Utility for loading icons with theme support and fallbacks. More...

#include <frontend/include/helpers/icon_loader.hpp>

Static Public Member Functions

static QIcon themed (std::initializer_list< const char * > names, QStyle::StandardPixmap fallback)
 Load a themed icon using multiple candidate names.

Detailed Description

Utility for loading icons with theme support and fallbacks.

This helper tries to obtain icons from the current desktop theme using a list of possible icon names (in priority order). If none of the themed icons are available, it falls back to a Qt standard pixmap from the current application style.

On Android builds, themed-icon lookup is skipped by design and the fallback icon is returned immediately.

Definition at line 20 of file icon_loader.hpp.

Member Function Documentation

◆ themed()

QIcon icon_loader::themed ( std::initializer_list< const char * > names,
QStyle::StandardPixmap fallback )
static

Load a themed icon using multiple candidate names.

The function iterates over names and returns the first non-null icon found via QIcon::fromTheme. If all candidates fail (or if themed icons are disabled on the platform), a standard style icon specified by fallback is returned.

Parameters
namesCandidate icon names in theme lookup order.
fallbackQt standard pixmap to use when no themed icon is found.
Returns
A valid icon: either a themed icon or a style fallback.

Definition at line 3 of file icon_loader.cpp.

6 {
7
8#if !(defined(KC_ANDROID) || defined(Q_OS_ANDROID))
9 for (auto name : names) {
10 QIcon ico = QIcon::fromTheme(QString::fromLatin1(name));
11 if (!ico.isNull()) {
12 return ico;
13 }
14 }
15#endif
16 return QApplication::style()->standardIcon(fallback);
17}

The documentation for this class was generated from the following files: