Salome HOME
Issue #1075: Disable Delete command on sub-feature object
authorvsv <vitaly.smetannikov@opencascade.com>
Wed, 11 Nov 2015 11:26:48 +0000 (14:26 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Wed, 11 Nov 2015 11:27:00 +0000 (14:27 +0300)
src/ModuleBase/ModuleBase_Tools.cpp
src/XGUI/XGUI_ContextMenuMgr.cpp

index 5d3643ab79a3b882a54a400c0a2f00b11c53dade..889da3e0e7fa8d9941e5526b7a64c3299d612e99 100755 (executable)
@@ -245,11 +245,11 @@ void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFe
     ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
     ResultParameterPtr aConstruction = std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aResult);
 
-    hasResult = (aResult.get() != NULL);
-    hasFeature = (aFeature.get() != NULL);
-    hasParameter = (aConstruction.get() != NULL);
+    hasResult |= (aResult.get() != NULL);
+    hasFeature |= (aFeature.get() != NULL);
+    hasParameter |= (aConstruction.get() != NULL);
     if (hasFeature) 
-      hasSubFeature = (ModelAPI_Tools::compositeOwner(aFeature) != NULL);
+      hasSubFeature |= (ModelAPI_Tools::compositeOwner(aFeature) != NULL);
     if (hasFeature && hasResult  && hasParameter && hasSubFeature)
       break;
   }
index 7b570f9cc678e355d46742099997b519f4a70d1e..7c40774ddf0edbc0d0206e3ca33c9a0de7a1b15d 100644 (file)
@@ -218,7 +218,7 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
         if( aMgr->activeDocument() == aObject->document() )
         {
           action("RENAME_CMD")->setEnabled(true);
-          action("DELETE_CMD")->setEnabled(true);
+          action("DELETE_CMD")->setEnabled(!hasSubFeature);
         }
       }
     } else {