From dc8be5e59d71e392c2379e07331d0fe248c2156a Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 13 Jul 2015 09:10:19 +0300 Subject: [PATCH] activate by preselection should be done at the end of the onOperationStarted slot. Yellow line stays in the viewer after creation a parallel constraint by preselection. --- src/ModuleBase/ModuleBase_Operation.cpp | 10 +++++++--- src/XGUI/XGUI_Workshop.cpp | 6 ++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/ModuleBase/ModuleBase_Operation.cpp b/src/ModuleBase/ModuleBase_Operation.cpp index c54130b48..fd2e8f9e6 100644 --- a/src/ModuleBase/ModuleBase_Operation.cpp +++ b/src/ModuleBase/ModuleBase_Operation.cpp @@ -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& 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 diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 755f4b732..b2bb15a38 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -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(); } //****************************************************** -- 2.39.2