Salome HOME
#1309 Management of icons: parallel icon of SketchPlugin is loaded from it.
[modules/shaper.git] / src / ModuleBase / ModuleBase_IconFactory.cpp
index 479e681cce7bbbfa839f34abba1e4f2781f1f528..2e8311e523940c4cffed70404601dc48a820ffad 100644 (file)
@@ -4,9 +4,12 @@
 // Created:     28 Jul 2015
 // Author:      Vitaly SMETANNIKOV
 
-
 #include "ModuleBase_IconFactory.h"
 
+#include "Config_XMLReader.h"
+
+#include <QDir>
+
 ModuleBase_IconFactory* MYIconFactory = 0;
 
 
@@ -37,11 +40,14 @@ QIcon ModuleBase_IconFactory::getIcon(ObjectPtr theIcon)
 
 QIcon ModuleBase_IconFactory::loadIcon(const QString& theValue)
 {
-  QIcon anIcon(theValue);
-
-  if (anIcon.isNull()) {
-    
+  QPixmap aPixmap(theValue);
+
+  if (aPixmap.isNull()) {
+    std::string aPluginPath = Config_XMLReader::pluginConfigFile();
+    QString anIconPath = QString::fromStdString(aPluginPath) + QDir::separator() +
+                         theValue;
+    if (QFile::exists(anIconPath))
+      aPixmap = QPixmap(anIconPath);
   }
-
-  return anIcon;
+  return QIcon(aPixmap);
 }