X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_Tools.cpp;h=f246677ce22ad2e8a0aaff7dbac4d01854c3c991;hb=5746238455553297ce5333502e6f27e6e5d9348b;hp=8c0471d9503f8b3f5cfee81a9c47754f2f151740;hpb=8587c5429aceac2d943a177dd36fe8bf50d047cf;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index 8c0471d95..f246677ce 100644 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -3,40 +3,47 @@ // Author: Vitaly Smetannikov #include "ModuleBase_Tools.h" -#include -#include -#include +#include +#include -namespace ModuleBase_Tools -{ +namespace ModuleBase_Tools { + +//****************************************************************** //****************************************************************** -boost::shared_ptr shape(ResultPtr theResult) + +void adjustMargins(QWidget* theWidget) { - ResultBodyPtr aBody = boost::dynamic_pointer_cast(theResult); - if (aBody) - return aBody->shape(); + if(!theWidget) + return; + adjustMargins(theWidget->layout()); +} - ResultConstructionPtr aConstruct = boost::dynamic_pointer_cast(theResult); - if (aConstruct) - return aConstruct->shape(); +void adjustMargins(QLayout* theLayout) +{ + if(!theLayout) + return; + theLayout->setContentsMargins(2, 5, 5, 2); + theLayout->setSpacing(4); +} - return boost::shared_ptr(); +void zeroMargins(QWidget* theWidget) +{ + if(!theWidget) + return; + zeroMargins(theWidget->layout()); } -//****************************************************************** -FeaturePtr feature(ObjectPtr theObject) +void zeroMargins(QLayout* theLayout) { - FeaturePtr aFeature = boost::dynamic_pointer_cast(theObject); - if (!aFeature) { - ResultPtr aResult = boost::dynamic_pointer_cast(theObject); - if (aResult) { - PluginManagerPtr aMgr = ModelAPI_PluginManager::get(); - DocumentPtr aDoc = aMgr->rootDocument(); - return aDoc->feature(aResult); - } - } - return aFeature; + if(!theLayout) + return; + theLayout->setContentsMargins(0, 0, 0, 0); + theLayout->setSpacing(5); } -} \ No newline at end of file + + +} + +