]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
activate by preselection should be done at the end of the onOperationStarted slot.
authornds <natalia.donis@opencascade.com>
Mon, 13 Jul 2015 06:10:19 +0000 (09:10 +0300)
committernds <natalia.donis@opencascade.com>
Mon, 13 Jul 2015 06:10:19 +0000 (09:10 +0300)
Yellow line stays in the viewer after creation a parallel constraint by preselection.

src/ModuleBase/ModuleBase_Operation.cpp
src/XGUI/XGUI_Workshop.cpp

index c54130b4800a441922773f4a0a5b6d41786d23d0..fd2e8f9e61535dffe6d54ce3cde7ea20314f2561 100644 (file)
@@ -268,8 +268,10 @@ void ModuleBase_Operation::commitOperation()
 
 void ModuleBase_Operation::activateByPreselection()
 {
-  ModuleBase_ModelWidget* aFilledWgt = 0;
+  if (myPreSelection.empty())
+    return;
 
+  ModuleBase_ModelWidget* aFilledWgt = 0;
   if (myPropertyPanel && !myPreSelection.empty()) {
     const QList<ModuleBase_ModelWidget*>& aWidgets = myPropertyPanel->modelWidgets();
     if (!aWidgets.empty()) {
@@ -387,8 +389,10 @@ void ModuleBase_Operation::setPropertyPanel(ModuleBase_IPropertyPanel* theProp)
 
   // Do not activate widgets by default if the current operation is editing operation
   // Because we don't know which widget is going to be edited. 
-  if (!isEditOperation())
-    activateByPreselection();
+  if (!isEditOperation()) {
+    // 4. activate the first obligatory widget
+    myPropertyPanel->activateNextWidget(NULL);
+  }
 }
 
 bool ModuleBase_Operation::isGranted(QString theId) const
index 755f4b732eca881ab4ddadceaa0cebbfd64a73b8..b2bb15a387c6e7fa2d59aaa8d420d26443d3db5e 100644 (file)
@@ -384,6 +384,12 @@ void XGUI_Workshop::onOperationStarted(ModuleBase_Operation* theOperation)
     deactivateActiveObject(*anIt, false);
   if (anObjects.size() > 0)
     myDisplayer->updateViewer();
+
+  // filling the operation values by the selection in the viewer
+  // it should be perfomed at the end of the method because it can commit the operation
+  // if after the controls fill, the operation becomes valid
+  if (!theOperation->isEditOperation())
+    theOperation->activateByPreselection();
 }
 
 //******************************************************