Salome HOME
Fixed problem with too many executions of extrusion wit hexternal sketch edges
[modules/shaper.git] / src / ModuleBase / ModuleBase_Tools.cpp
index 3f0069eca9640597f7c35a9033f82e48a6bc7d1d..8df14bdc35b74bfb93fce4cdb053f9ac5c302114 100644 (file)
@@ -5,22 +5,42 @@
 #include "ModuleBase_Tools.h"
 #include <ModelAPI_ResultBody.h>
 #include <ModelAPI_ResultConstruction.h>
+#include <ModelAPI_Document.h>
 
-namespace ModuleBase_Tools
-{
+namespace ModuleBase_Tools {
+
+//******************************************************************
 
 //******************************************************************
-boost::shared_ptr<GeomAPI_Shape> shape(ResultPtr theResult)
+
+void adjustMargins(QWidget* theWidget)
+{
+  if(!theWidget)
+    return;
+  adjustMargins(theWidget->layout());
+}
+
+void adjustMargins(QLayout* theLayout)
 {
-  ResultBodyPtr aBody = boost::dynamic_pointer_cast<ModelAPI_ResultBody>(theResult);
-  if (aBody)
-    return aBody->shape();
+  if(!theLayout)
+    return;
+  theLayout->setContentsMargins(2, 5, 5, 2);
+  theLayout->setSpacing(4);
+}
 
-  ResultConstructionPtr aConstruct = boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theResult);
-  if (aConstruct)
-    return aConstruct->shape();
+void zeroMargins(QWidget* theWidget)
+{
+  if(!theWidget)
+    return;
+  zeroMargins(theWidget->layout());
+}
 
-  return boost::shared_ptr<GeomAPI_Shape>();
+void zeroMargins(QLayout* theLayout)
+{
+  if(!theLayout)
+    return;
+  theLayout->setContentsMargins(0, 0, 0, 0);
+  theLayout->setSpacing(5);
 }
 
-}
\ No newline at end of file
+}