7#include <QtGui/private/qtguiglobal_p.h>
22#include <QtGui/QIconEngine>
23#include <QtCore/QList>
24#include <QtCore/QSharedPointer>
25#include <QtCore/QVarLengthArray>
26#include <private/qflatmap_p.h>
27#include <private/qiconengine_p.h>
75 QPixmap pixmap(
const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale)
override;
81 QPixmap pixmap(
const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale)
override;
85using QThemeIconEntries = std::vector<std::unique_ptr<QIconLoaderEngineEntry>>;
98 bool read(QDataStream &in)
override;
99 bool write(QDataStream &out)
const override;
109 mutable uint m_themeKey = 0;
111 mutable std::unique_ptr<QIconEngine> m_proxiedEngine;
120 void paint(QPainter *painter,
const QRect &rect, QIcon::Mode mode, QIcon::State state)
override;
121 QPixmap pixmap(
const QSize &size, QIcon::Mode mode, QIcon::State state)
override;
122 QSize actualSize(
const QSize &size, QIcon::Mode mode, QIcon::State state)
override;
127 QPixmap scaledPixmap(
const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale)
override;
136 bool hasIcon()
const;
141 friend class QIconLoader;
156 QStringList m_contentDirs;
157 QList<QIconDirInfo> m_keyList;
158 QStringList m_parents;
159 bool m_valid =
false;
164class QIconEnginePlugin;
170 QThemeIconInfo loadIcon(
const QString &iconName)
const;
171 uint themeKey()
const {
return m_themeKey; }
173 QString themeName()
const;
174 void setThemeName(
const QString &themeName);
175 QString fallbackThemeName()
const;
176 void setFallbackThemeName(
const QString &themeName);
177 QIconTheme theme() {
return themeList.value(themeName()); }
178 void setThemeSearchPath(
const QStringList &searchPaths);
179 QStringList themeSearchPaths()
const;
180 void setFallbackSearchPaths(
const QStringList &searchPaths);
181 QStringList fallbackSearchPaths()
const;
182 QIconDirInfo dirInfo(
int dirindex);
183 static QIconLoader *instance();
184 void updateSystemTheme();
185 void invalidateKey();
186 void ensureInitialized();
187 bool hasUserTheme()
const {
return !m_userTheme.isEmpty(); }
189 QIconEngine *iconEngine(
const QString &iconName)
const;
192 enum DashRule { FallBack, NoFallBack };
193 QThemeIconInfo findIconHelper(
const QString &themeName,
194 const QString &iconName,
195 QStringList &visited,
196 DashRule rule)
const;
197 QThemeIconInfo lookupFallbackIcon(
const QString &iconName)
const;
200 mutable std::optional<QIconEnginePlugin *> m_factory;
204 mutable QString m_userTheme;
205 mutable QString m_userFallbackTheme;
206 mutable QString m_systemTheme;
207 mutable QStringList m_iconDirs;
208 mutable QVarLengthFlatMap <QString, QIconTheme, 5> themeList;
209 mutable QStringList m_fallbackDirs;
210 mutable QString m_iconName;
virtual QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale)=0
virtual ~QIconLoaderEngineEntry()=default
An icon engine based on icon entries collected by QIconLoader.
QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) override
Returns the actual size of the icon the engine provides for the requested size, mode and state.
QPixmap scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale) override
QIconLoaderEngine(const QString &iconName=QString())
QString iconName() override
Returns the name used to create the engine, if available.
QList< QSize > availableSizes(QIcon::Mode mode, QIcon::State state) override
Returns sizes of all images that are contained in the engine for the specific mode and state.
void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) override
Uses the given painter to paint the icon with the required mode and state into the rectangle rect.
QIconEngine * clone() const override
Reimplement this method to return a clone of this icon engine.
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override
Returns the icon as a pixmap with the required size, mode, and state.
QIconTheme(const QString &name)
QStringList parents() const
QStringList contentDirs() const
QList< QSharedPointer< QIconCacheGtkReader > > m_gtkCaches
QList< QIconDirInfo > keyList() const
A named-based icon engine for providing theme icons.
QThemeIconEngine(const QString &iconName=QString())
QString key() const override
\variable QIconEngine::ScaledPixmapArgument::size
bool write(QDataStream &out) const override
Writes the contents of this engine to the QDataStream out.
bool read(QDataStream &in) override
Reads icon engine contents from the QDataStream in.
QIconEngine * clone() const override
Reimplement this method to return a clone of this icon engine.
QIconEngine * proxiedEngine() const override
Q_DECLARE_TYPEINFO(QIconDirInfo, Q_RELOCATABLE_TYPE)
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale) override
QIconDirInfo(const QString &_path=QString())
QThemeIconEntries entries
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale) override