From 4530400268bf9a8749513e69a7bfb574fca20f09 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 3 Aug 2017 14:03:29 -0400 Subject: Cleanup some fallback routines for loading icons from the Qt theme methods. --- src-qt5/core/libLumina/LIconCache.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src-qt5/core/libLumina/LIconCache.cpp') diff --git a/src-qt5/core/libLumina/LIconCache.cpp b/src-qt5/core/libLumina/LIconCache.cpp index 9d122df7..bb81bc47 100644 --- a/src-qt5/core/libLumina/LIconCache.cpp +++ b/src-qt5/core/libLumina/LIconCache.cpp @@ -55,9 +55,9 @@ QString LIconCache::findFile(QString icon){ if(icon.isEmpty()){ return ""; } //Get the currently-set theme QString cTheme = QIcon::themeName(); - if(cTheme.isEmpty()){ - QIcon::setThemeName("material-design-light"); - cTheme = "material-design-light"; + if(cTheme.isEmpty()){ + QIcon::setThemeName("material-design-light"); + cTheme = "material-design-light"; } //Make sure the current search paths correspond to this theme if( QDir::searchPaths("icontheme").filter("/"+cTheme+"/").isEmpty() ){ @@ -309,7 +309,12 @@ bool LIconCache::isThemeIcon(QString id){ } QIcon LIconCache::iconFromTheme(QString id){ - return QIcon::fromTheme(id); + QIcon ico = QIcon::fromTheme(id); + if(ico.isNull()){ + //icon missing in theme? run the old icon-finder system + ico = QIcon(findFile(id)); + } + return ico; } // === PRIVATE SLOTS === -- cgit