OSDN Git Service

QIconLoaderEngineEntry and QIconLoader friendship has been broken
authorIvailo Monev <xakepa10@gmail.com>
Thu, 25 May 2023 00:02:17 +0000 (03:02 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Thu, 25 May 2023 00:02:17 +0000 (03:02 +0300)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/gui/image/qiconloader.cpp
src/gui/image/qiconloader_p.h

index 17cf10d..9a31c3d 100644 (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();
 }
index 6624f24..9c7c94b 100644 (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