Salome HOME
Create validator for distance constraint
[modules/shaper.git] / src / XGUI / XGUI_PropertyPanel.cpp
index e9383b4d71bfef5cce48587573e689dba4419087..5b26e4e6a8f62b7937613382b6bfcceb36a598b0 100644 (file)
@@ -72,17 +72,8 @@ XGUI_PropertyPanel::~XGUI_PropertyPanel()
 
 void XGUI_PropertyPanel::cleanContent()
 {
-  myWidgets.clear();
-  
-  QLayoutItem* aItem = myMainLayout->takeAt(myMainLayout->count() - 1);
-  delete aItem;
-
-  myMainLayout->removeWidget(myCustomWidget);
-  delete myCustomWidget;
-
-  myCustomWidget = new QWidget(widget());
-  myMainLayout->addWidget(myCustomWidget);
-  myMainLayout->addStretch(1);
+  myWidgets.clear(); 
+  qDeleteAll(myCustomWidget->children());
 }
 
 void XGUI_PropertyPanel::setModelWidgets(const QList<ModuleBase_ModelWidget*>& theWidgets)
@@ -103,8 +94,8 @@ void XGUI_PropertyPanel::setModelWidgets(const QList<ModuleBase_ModelWidget*>& t
 
       ModuleBase_WidgetPoint2D* aPointWidget = dynamic_cast<ModuleBase_WidgetPoint2D*>(*anIt);
       if (aPointWidget)
-        connect(aPointWidget, SIGNAL(storedPoint2D(FeaturePtr, const std::string&)),
-                this, SIGNAL(storedPoint2D(FeaturePtr, const std::string&)));
+        connect(aPointWidget, SIGNAL(storedPoint2D(ObjectPtr, const std::string&)),
+                this, SIGNAL(storedPoint2D(ObjectPtr, const std::string&)));
     }
     ModuleBase_ModelWidget* aLastWidget = theWidgets.last();
     if (aLastWidget) {
@@ -153,7 +144,8 @@ QWidget* XGUI_PropertyPanel::contentWidget()
 void XGUI_PropertyPanel::updateContentWidget(FeaturePtr theFeature)
 {
   foreach(ModuleBase_ModelWidget* eachWidget, myWidgets) {
-    eachWidget->restoreValue(theFeature);
+    eachWidget->setFeature(theFeature);
+    eachWidget->restoreValue();
   }
   // the repaint is used here to immediatelly react in GUI to the values change.
   repaint();
@@ -165,8 +157,7 @@ void XGUI_PropertyPanel::onActivateNextWidget(ModuleBase_ModelWidget* theWidget)
   QList<ModuleBase_ModelWidget*>::const_iterator anIt = myWidgets.begin(),
                                                  aLast = myWidgets.end();
   bool isFoundWidget = false;
-  for (;anIt != aLast && !aNextWidget; anIt++)
-  {
+  for (;anIt != aLast && !aNextWidget; anIt++) {
     if (isFoundWidget || !theWidget) {
       if ((*anIt)->focusTo()) {
         aNextWidget = *anIt;