]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/ModuleBase/ModuleBase_IconFactory.cpp
Salome HOME
Issue #1309 Management of icons - corrections for PythonAddons plugin, to load icons...
[modules/shaper.git] / src / ModuleBase / ModuleBase_IconFactory.cpp
index 2e8311e523940c4cffed70404601dc48a820ffad..4b6355377c4ffeef60adc672ea98aeee15c922f1 100644 (file)
@@ -39,15 +39,32 @@ QIcon ModuleBase_IconFactory::getIcon(ObjectPtr theIcon)
 }
 
 QIcon ModuleBase_IconFactory::loadIcon(const QString& theValue)
+{
+  return QIcon(loadPixmap(theValue));
+}
+
+QPixmap ModuleBase_IconFactory::loadPixmap(const QString& theValue)
 {
   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);
+    QString aPath = QString::fromStdString(aPluginPath) + QDir::separator() + theValue;
+    if (QFile::exists(aPath))
+      aPixmap = QPixmap(aPath);
+  }
+  return aPixmap;
+}
+
+QImage ModuleBase_IconFactory::loadImage(const QString& theValue)
+{
+  QImage anImage(theValue);
+
+  if (anImage.isNull()) {
+    std::string aPluginPath = Config_XMLReader::pluginConfigFile();
+    QString aPath = QString::fromStdString(aPluginPath) + QDir::separator() + theValue;
+    if (QFile::exists(aPath))
+      anImage = QImage(aPath);
   }
-  return QIcon(aPixmap);
+  return anImage;
 }