QIconLoaderEngineEntry and QIconLoader friendship has been broken

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-05-25 03:02:17 +03:00
parent c058f1662c
commit 84633b3544
2 changed files with 23 additions and 19 deletions

View file

@ -161,8 +161,8 @@ QIconTheme::QIconTheme(const QString &themeName)
}
QThemeIconEntries QIconLoader::findIconHelper(const QString &themeName,
const QString &iconName,
QStringList &visited) const
const QString &iconName,
QStringList &visited) const
{
QThemeIconEntries entries;
Q_ASSERT(!themeName.isEmpty());
@ -208,11 +208,14 @@ QThemeIconEntries QIconLoader::findIconHelper(const QString &themeName,
if (entries.isEmpty()) {
// Search recursively through inherited themes
foreach (const QString &parentTheme, theme.parents()) {
if (!visited.contains(parentTheme)) // guard against recursion
if (!visited.contains(parentTheme)) { // guard against recursion
entries = findIconHelper(parentTheme, iconName, visited);
}
if (!entries.isEmpty()) // success
if (!entries.isEmpty()) {
// success
break;
}
}
}
return entries;
@ -230,10 +233,8 @@ QThemeIconEntries QIconLoader::loadIcon(const QString &name) const
// -------- Icon Loader Engine -------- //
QIconLoaderEngine::QIconLoaderEngine(const QString& iconName)
: m_iconName(iconName), m_key(0)
QIconLoaderEngine::QIconLoaderEngine(const QString &iconName)
: m_iconName(iconName), m_key(0)
{
ensureLoaded();
}

View file

@ -46,14 +46,19 @@ class QIconLoader;
struct QIconDirInfo
{
enum Type { Fixed, Scalable, Threshold };
QIconDirInfo(const QString &_path = QString()) :
path(_path),
size(0),
maxSize(0),
minSize(0),
threshold(0),
type(Threshold) {}
enum Type {
Fixed,
Scalable,
Threshold
};
QIconDirInfo(const QString &_path = QString())
: path(_path),
size(0),
maxSize(0),
minSize(0),
threshold(0),
type(Threshold) { }
QString path;
short size;
short maxSize;
@ -63,7 +68,7 @@ struct QIconDirInfo
};
class QIconLoaderEngineEntry
{
{
public:
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state);
@ -97,8 +102,6 @@ private:
QThemeIconEntries m_entries;
QString m_iconName;
uint m_key;
friend class QIconLoader;
};
class QIconTheme