X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetFactory.cpp;h=a88a3086063388ad47af60ad03e314a8f52d1f54;hb=96c062912cdd3eff24d2d28ab75769f26e0d84cd;hp=e651ba7d362fbf3d8dbba99b07b4bd78fa7493dd;hpb=49542ab918c826db5c10abda5be3787937113d94;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetFactory.cpp b/src/ModuleBase/ModuleBase_WidgetFactory.cpp index e651ba7d3..a88a30860 100644 --- a/src/ModuleBase/ModuleBase_WidgetFactory.cpp +++ b/src/ModuleBase/ModuleBase_WidgetFactory.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -60,7 +61,11 @@ void ModuleBase_WidgetFactory::createWidget(QWidget* theParent) //Create a widget (doublevalue, groupbox, toolbox, etc. QWidget* aWidget = createWidgetByType(aWdgType, theParent); if (aWidget) { - aWidgetLay->addWidget(aWidget); + if (!isInternalWidget(aWdgType)) { + aWidgetLay->addWidget(aWidget); + } + else + aWidget->setVisible(false); } if (myWidgetApi->isContainerWidget()) { //if current widget is groupbox (container) process it's children recursively @@ -95,6 +100,7 @@ QWidget* ModuleBase_WidgetFactory::labelControl(QWidget* theParent) QWidget* result = new QWidget(theParent); QVBoxLayout* aLabelLay = new QVBoxLayout(result); QLabel* aLabel = new QLabel(result); + aLabel->setWordWrap(true); aLabel->setText(qs(myWidgetApi->getProperty(INFO_WDG_TEXT))); aLabel->setToolTip(qs(myWidgetApi->getProperty(INFO_WDG_TOOLTIP))); aLabelLay->addWidget(aLabel); @@ -126,6 +132,9 @@ QWidget* ModuleBase_WidgetFactory::createWidgetByType(const std::string& theType } else if (theType == WDG_DOUBLEVALUE_EDITOR) { result = doubleValueEditor(theParent); + + } else if (theType == WDG_POINT2D_DISTANCE) { + result = point2dDistanceControl(theParent); } else if (myWidgetApi->isContainerWidget() || myWidgetApi->isPagedWidget()) { @@ -191,6 +200,16 @@ QString ModuleBase_WidgetFactory::qs(const std::string& theStdString) const return QString::fromStdString(theStdString); } +bool ModuleBase_WidgetFactory::isInternalWidget(const std::string& theType) +{ + std::string prop = myWidgetApi->getProperty(FEATURE_INTERNAL); + + std::transform(prop.begin(), prop.end(), prop.begin(), ::tolower); + if(prop.empty() || prop == "false" || prop == "0") { + return false; + } + return true; +} QWidget* ModuleBase_WidgetFactory::selectorControl(QWidget* theParent) { @@ -206,4 +225,13 @@ QWidget* ModuleBase_WidgetFactory::booleanControl(QWidget* theParent) myModelWidgets.append(aBoolWgt); return aBoolWgt->getControl(); +} + + +QWidget* ModuleBase_WidgetFactory::point2dDistanceControl(QWidget* theParent) +{ + ModuleBase_WidgetPoint2dDistance* aDistWgt = new ModuleBase_WidgetPoint2dDistance(theParent, myWidgetApi); + myModelWidgets.append(aDistWgt); + + return aDistWgt->getControl(); } \ No newline at end of file