Salome HOME
Merge branch 'Dev_0.6' of newgeom:newgeom into Dev_0.6
authornds <natalia.donis@opencascade.com>
Mon, 8 Dec 2014 16:40:58 +0000 (19:40 +0300)
committernds <natalia.donis@opencascade.com>
Mon, 8 Dec 2014 16:40:58 +0000 (19:40 +0300)
src/ModuleBase/ModuleBase_Tools.cpp
src/PartSet/PartSet_WidgetPoint2d.cpp
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h

index b95b5bc9f41eeb8144c94bec40dbc92b9f21e3cc..0f57b4c7b7fedc812fa84c3cc465d9d369d6205f 100644 (file)
@@ -53,12 +53,21 @@ QPixmap composite(const QString& theAdditionalIcon, const int theXShift,
   if (anIcon.isNull())
     return QPixmap();
 
-  for (int i = theXShift; i < anAditional.width() + theXShift && i < anIcon.width(); i++)
+  int anAddWidth = anAditional.width();
+  int anAddHeight = anAditional.height();
+
+  int aWidth = anIcon.width();
+  int aHeight = anIcon.height();
+
+  int aStartWidthPos = aWidth-anAddWidth-1;
+  int aStartHeightPos = aHeight-anAddHeight-1;
+
+  for (int i = 0; i < anAddWidth; i++)
   {
-    for (int j = theYShift; j < anAditional.height() + theYShift && j < anIcon.height(); j++)
+    for (int j = 0; j < anAddHeight; j++)
     {
-      if (qAlpha(anAditional.pixel(i - theXShift, j - theYShift)) > 0)
-        anIcon.setPixel(i, j, anAditional.pixel(i - theXShift, j - theYShift));
+      if (qAlpha(anAditional.pixel(i, j)) > 0)
+        anIcon.setPixel(i + aStartWidthPos, j + aStartHeightPos, anAditional.pixel(i, j));
     }
   }
   return QPixmap::fromImage(anIcon);
index d21d25f0a835ed19efefaa56446cf9425e840b4c..75f60a992b4a497aeb19f0b937a0cb3f4488f156 100644 (file)
@@ -241,7 +241,6 @@ void PartSet_WidgetPoint2D::onMouseRelease(ModuleBase_IViewWindow* theWnd, QMous
 
       PartSet_Tools::setConstraints(mySketch, feature(), attributeID(),aX, aY);
       emit vertexSelected(aObjects.front(), aShape);
-      QApplication::processEvents();
       emit focusOutWidget(this);
       return;
     }
index 8a696e67ed365e7e3c8004604963703a743ce482..0bf4c4bcb84ca93108fe097c9e5935261cad7ed9 100644 (file)
 
 QMap<QString, QString> XGUI_Workshop::myIcons;
 
-QPixmap XGUI_Workshop::featureIcon(const FeaturePtr& theFeature)
+std::string XGUI_Workshop::featureIconStr(const FeaturePtr& theFeature)
 {
-  QPixmap aPixmap;
-
   std::string aKind = theFeature->getKind();
   QString aId(aKind.c_str());
   if (!myIcons.contains(aId))
-    return aPixmap;
+    return std::string();
+
+  return myIcons[aId].toStdString();
+}
 
-  QString anIconString = myIcons[aId];
+QIcon XGUI_Workshop::featureIcon(const FeaturePtr& theFeature)
+{
+  QIcon anIcon;
+
+  QString anIconString = featureIconStr(theFeature).c_str();
 
   ModelAPI_ExecState aState = theFeature->data()->execState();
   switch(aState) {
     case ModelAPI_StateDone:
     case ModelAPI_StateNothing:
-      aPixmap = QPixmap(anIconString);
-    break;
+      anIcon = QIcon(anIconString);
     case ModelAPI_StateMustBeUpdated: {
-      aPixmap = ModuleBase_Tools::lighter(anIconString);
+      anIcon = ModuleBase_Tools::lighter(anIconString);
     }
     break;
     case ModelAPI_StateExecFailed: {
-      aPixmap = ModuleBase_Tools::composite(":pictures/exec_state_failed.png",
+      anIcon = ModuleBase_Tools::composite(":pictures/exec_state_failed.png",
                                            12, 12, anIconString);
     }
     break;
     case ModelAPI_StateInvalidArgument: {
-      aPixmap = ModuleBase_Tools::composite(":pictures/exec_state_invalid_parameters.png",
+      anIcon = ModuleBase_Tools::composite(":pictures/exec_state_invalid_parameters.png",
                                            12, 12, anIconString);
     }
     break;
     default: break;  
   }
-
-  return aPixmap;
+  return anIcon;  
 }
 
 XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
index 54e9f26fdcae4f213a317f5c4893691f00e2b0c9..95a70579a92d07c22c5946a235c92453863b4570 100644 (file)
@@ -11,7 +11,7 @@
 #include <QObject>
 #include <QMap>
 #include <QKeySequence>
-#include <QPixmap>
+#include <QIcon>
 
 class XGUI_MainWindow;
 class XGUI_Command;
@@ -143,8 +143,11 @@ Q_OBJECT
     return myModuleConnector;
   }
 
-  //! Returns icon name according to feature Id
-  static QPixmap featureIcon(const FeaturePtr& theFeature);
+  //! Returns icon name according to feature
+  static QIcon featureIcon(const FeaturePtr& theFeature);
+
+  //! Returns icon name according to feature
+  static std::string featureIconStr(const FeaturePtr& theFeature);
 
   //! Activates or deactivates a part
   //! If PartPtr is Null pointer then PartSet will be activated