From: nds Date: Wed, 8 Jul 2015 16:43:55 +0000 (+0300) Subject: Set "Apply" command button enabled in the tool bar of the application when nested... X-Git-Tag: V_1.3.0~66 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=876b136aba9763be6bd924aa54ed61f73235d7b7;p=modules%2Fshaper.git Set "Apply" command button enabled in the tool bar of the application when nested operation is active. --- diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index b5579b88c..c04cb9c6c 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -248,8 +248,19 @@ void XGUI_OperationMgr::onOperationStarted() { ModuleBase_Operation* aSenderOperation = dynamic_cast(sender()); - bool isNestedOk = (myOperations.count() >= 1) && - myOperations.at(0)->isValid(); + // the enable state of the parent operation of the nested one is defined by the rules that + // firstly there are nested operations and secondly the parent operation is valid + ModuleBase_Operation* aPrevOp; + Operations::const_iterator anIt = myOperations.end(); + if (anIt != myOperations.begin()) { // there are items in the operations list + --anIt; + aPrevOp = *anIt; // the last top operation, the operation which is started + if (anIt != myOperations.begin()) { // find the operation where the started operation is nested + --anIt; + aPrevOp = *anIt; + } + } + bool isNestedOk = (myOperations.count() >= 1) && aPrevOp->isValid(); emit nestedStateChanged(isNestedOk); emit operationStarted(aSenderOperation); }