core/icon: ability to specify a fallback or check if an icon exists

This commit is contained in:
outfoxxed 2024-11-17 14:38:29 -08:00
parent d2667369e1
commit 68ba5005ce
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
4 changed files with 42 additions and 4 deletions

View file

@ -137,6 +137,12 @@ public:
/// > at the top of your root config file or set the `QS_ICON_THEME` variable to the name
/// > of your icon theme.
Q_INVOKABLE static QString iconPath(const QString& icon);
/// Setting the `check` parameter of `iconPath` to true will return an empty string
/// if the icon does not exist, instead of an image showing a missing texture.
Q_INVOKABLE static QString iconPath(const QString& icon, bool check);
/// Setting the `fallback` parameter of `iconPath` will attempt to load the fallback
/// icon if the requested one could not be loaded.
Q_INVOKABLE static QString iconPath(const QString& icon, const QString& fallback);
[[nodiscard]] QString shellRoot() const;