]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Init feature by model widget factory content
authornds <natalia.donis@opencascade.com>
Wed, 11 Jun 2014 08:00:23 +0000 (12:00 +0400)
committernds <natalia.donis@opencascade.com>
Wed, 11 Jun 2014 08:00:23 +0000 (12:00 +0400)
The code is moved here to be applyed for all types of features.

src/ModuleBase/ModuleBase_WidgetFactory.cpp
src/XGUI/XGUI_Workshop.cpp

index e52d5b2d4a78f6bdc8948b3face829e1ba38b22e..239b3eda336bdcf0034bbdec8d71c8b53ead0570 100644 (file)
@@ -155,9 +155,6 @@ QWidget* ModuleBase_WidgetFactory::doubleSpinBoxControl(QWidget* theParent)
 
   myModelWidgets.append(aDblWgt);
 
-  // Init default values
-  if (!myOperation->isEditOperation())
-    aDblWgt->storeValue(myOperation->feature());
   return aDblWgt->getControl();
 }
 
@@ -207,8 +204,5 @@ QWidget* ModuleBase_WidgetFactory::booleanControl(QWidget* theParent)
 
   myModelWidgets.append(aBoolWgt);
 
-  // Init default values
-  if (!myOperation->isEditOperation())
-    aBoolWgt->storeValue(myOperation->feature());
   return aBoolWgt->getControl();
 }
\ No newline at end of file
index c4c6ac93951c4a80300d7f7e5278e6b2d26fc9e4..24fea8453e98aab44e834f9efca2895d1c39142e 100644 (file)
@@ -317,6 +317,16 @@ void XGUI_Workshop::onOperationStarted()
     QWidget* aContent = myPropertyPanel->contentWidget();
     qDeleteAll(aContent->children());
     aFactory.createWidget(aContent);
+
+    // Init default values
+    if (!aOperation->isEditOperation()) {
+      QList<ModuleBase_ModelWidget*> aWidgets = aFactory.getModelWidgets();
+      QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
+      for (; anIt != aLast; anIt++) {
+        (*anIt)->storeValue(aOperation->feature());
+      }
+    }
+
     myPropertyPanel->setModelWidgets(aFactory.getModelWidgets());
     myPropertyPanel->setWindowTitle(aOperation->getDescription()->description());
   }