On Sun, Apr 24, 2011 at 10:03:09PM +0200, Jakob Haufe wrote:

> Hi!

Hi!

Thanks for looking into this despite its rather lower relevance. ;)


> It looks like this is actually a "bug" in Qt. Quoting from Qt4.7's
> src/gui/image/qiconloader.cpp:
> 
> ----
> /* Theme to use in last resort, if the theme does not have the icon, neither
> the parents  */ static QString fallbackTheme()
> {
> #ifdef Q_WS_X11
>     if (X11->desktopEnvironment == DE_GNOME) {
>         return QLatin1String("gnome");
>     } else if (X11->desktopEnvironment == DE_KDE) {
>         return X11->desktopVersion >= 4
>             ? QString::fromLatin1("oxygen")
>             : QString::fromLatin1("crystalsvg");
>     } else {
>         return QLatin1String("hicolor");
>     }
> #endif
>     return QString();
> }
> ----
> 
> Unfortunately, hicolor does not seem to have audio-volume-high nor
> audio-volume-muted. It also seems to be missing other icons which get
> rendered as text.
> 
> So I actually don't know how to fix this in a clean way.

I guess a clean way would be to add the missing icons to the hicolor
theme, ideally upstream. Maybe we could simply reassign the bug to
hicolor-icon-theme and change severity to wishlist. Lazy but effective.
Hopefully. ;)

Another solution would be something like adding multiple search paths to
QT's icon loader for the non-{GNOME,KDE} case. Because I *do* have
"gnome", "oxygen" and "crystalsvg" all installed, QT's just not
searching for them.

>From a quick look at the code, I guess it's possible to copy the
fallbackTheme function to allFallbackThemes() and return QStringList
instead of QString containing all of the icon themes in the last else
branch.

(patch attached, completely untested)


Cheers

-- 
mail: a...@thur.de      http://adi.thur.de      PGP/GPG: key via keyserver
--- qt4-x11/src/gui/image/qiconloader.cpp	2011-02-22 13:03:59.000000000 +0100
+++ qiconloader.cpp	2011-04-25 00:37:40.000000000 +0200
@@ -69,20 +69,28 @@
 
 Q_GLOBAL_STATIC(QIconLoader, iconLoaderInstance)
 
-/* Theme to use in last resort, if the theme does not have the icon, neither the parents  */
-static QString fallbackTheme()
+static QStringList allFallbackThemes()
 {
+    QStringList list;
 #ifdef Q_WS_X11
     if (X11->desktopEnvironment == DE_GNOME) {
-        return QLatin1String("gnome");
+        list << "gnome";
     } else if (X11->desktopEnvironment == DE_KDE) {
-        return X11->desktopVersion >= 4
-            ? QString::fromLatin1("oxygen")
-            : QString::fromLatin1("crystalsvg");
+        list << ((X11->desktopVersion >= 4) ?
+            "oxygen" : "crystalsvg");
     } else {
-        return QLatin1String("hicolor");
+        list << "gnome" << "oxygen" << "crystalsvg" << "hicolor";
     }
 #endif
+    return list;
+}
+
+/* Theme to use in last resort, if the theme does not have the icon, neither the parents  */
+static QString fallbackTheme()
+{
+#ifdef Q_WS_X11
+    return allFallbackThemes().last();
+#endif
     return QString();
 }
 
@@ -221,7 +229,7 @@
 
         // Ensure a default platform fallback for all themes
         if (m_parents.isEmpty())
-            m_parents.append(fallbackTheme());
+            m_parents.append(allFallbackThemes());
 
         // Ensure that all themes fall back to hicolor
         if (!m_parents.contains(QLatin1String("hicolor")))

Reply via email to