-#define TO_STRING(__NAME__) case __NAME__: return #__NAME__;
- switch (theExecState) {
- TO_STRING(ModelAPI_StateDone)
- TO_STRING(ModelAPI_StateMustBeUpdated)
- TO_STRING(ModelAPI_StateExecFailed)
- TO_STRING(ModelAPI_StateInvalidArgument)
- TO_STRING(ModelAPI_StateNothing)
- default: "Unknown ExecState.";
+ //update Ok Action and header of property panel if the current operation started for the feature
+ XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr();
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+ (workshop()->operationMgr()->currentOperation());
+ if (aFOperation && aFOperation->feature() == theFeature) {
+ QAction* anOkAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept);
+
+ ModuleBase_ModelWidget* anActiveWidget = activeWidget();
+ bool isApplyEnabledByActiveWidget = false;
+ if (anActiveWidget)
+ isApplyEnabledByActiveWidget = anActiveWidget->getValueState() ==
+ ModuleBase_ModelWidget::ModifiedInPP;
+ QString anError = "";
+ QString aWidgetError = "";
+ if (!isApplyEnabledByActiveWidget) {
+ anError = myWorkshop->module()->getFeatureError(theFeature);
+ if (anActiveWidget)
+ aWidgetError = anActiveWidget->getError();
+ if (anError.isEmpty())
+ anError = aWidgetError;
+ }
+ updateActionState(anOkAction, anError);
+ updateToolTip(anActiveWidget, aWidgetError);