Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
IconThemeResolver.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include <PhosphorServiceIconTheme/phosphorserviceicontheme_export.h>
7
8#include <QImage>
9#include <QList>
10#include <QObject>
11#include <QPair>
12#include <QSize>
13#include <QString>
14
15#include <memory>
16
18
29class PHOSPHORSERVICEICONTHEME_EXPORT IconThemeResolver : public QObject
30{
31 Q_OBJECT
32 Q_DISABLE_COPY_MOVE(IconThemeResolver)
33public:
35 static IconThemeResolver* instance();
36
40 void setThemeName(const QString& themeName);
41 [[nodiscard]] QString themeName() const;
42
55 [[nodiscard]] QImage iconForName(const QString& name, int size, int scale = 1,
56 const QString& extraThemeDir = {}) const;
57
61 [[nodiscard]] static QImage decodePixmaps(const QList<QPair<QSize, QByteArray>>& pixmaps, int size);
62
63Q_SIGNALS:
65
66private:
67 explicit IconThemeResolver(QObject* parent = nullptr);
68 ~IconThemeResolver() override;
69
70 class Private;
71 std::unique_ptr<Private> d;
72};
73
74} // namespace PhosphorServiceIconTheme
void setThemeName(const QString &themeName)
Force a theme override.
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 ...
Definition IconImageProvider.h:14