From 8a3aaa8971528932753e86f7e9721ca086cd3104 Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 20 Jul 2015 09:25:04 +0300 Subject: [PATCH] Apply action enable state correction. Create sketch with a closed contour. Edit sketch, move contour by point. Apply is disabled until the second move. --- src/PartSet/PartSet_SketcherMgr.cpp | 7 ++++++- src/XGUI/XGUI_Workshop.cpp | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index 4c83fb774..5dd9eaf20 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -529,8 +529,13 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve } // the modified state of the current operation should be updated if there are features, which // were changed here - if (isModified) + if (isModified) { aCurrentOperation->onValuesChanged(); + ModuleBase_IWorkshop* anIWorkshop = myModule->workshop(); + XGUI_ModuleConnector* aConnector = dynamic_cast(anIWorkshop); + XGUI_Workshop* aWorkshop = aConnector->workshop(); + aWorkshop->updateCompositeActionState(); + } Events_Loop::loop()->flush(aMoveEvent); // up all move events - to be processed in the solver //Events_Loop::loop()->flush(aUpdateEvent); // up update events - to redisplay presentations diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 0fdec6b58..27ef45623 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -857,9 +857,11 @@ void XGUI_Workshop::updateCompositeActionState() // e.g. sketch can be applyed only if at least one nested element create is finished bool aCanUndo = ModelAPI_Session::get()->canUndo(); bool aParentValid = operationMgr()->isParentOperationValid(); + bool aCurrentValid = operationMgr()->currentOperation() && + operationMgr()->currentOperation()->isValid(); QAction* aAcceptAllAct = myActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll); - aAcceptAllAct->setEnabled(aParentValid && aCanUndo); + aAcceptAllAct->setEnabled(aParentValid && (aCanUndo || aCurrentValid)); } void XGUI_Workshop::updateHistory() -- 2.39.2