Salome HOME
Issue #807: Show/hide commands have to be accessible only for current part and constr...
authorvsv <vitaly.smetannikov@opencascade.com>
Mon, 7 Sep 2015 08:14:38 +0000 (11:14 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Mon, 7 Sep 2015 08:17:22 +0000 (11:17 +0300)
src/XGUI/XGUI_ContextMenuMgr.cpp

index adbbdc5a28af820d4169a1dd1d7604bd9dff97ac..73889e19a89ce15912144e87ad9a2626d8908ca2 100644 (file)
@@ -229,15 +229,14 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
   }
 
   // Show/Hide command has to be disabled for objects from non active document
-  XGUI_ObjectsBrowser* aOB = myWorkshop->objectBrowser();
-  XGUI_DataModel* aModel = aOB->dataModel();
   bool aDeactivate = false;
   foreach (ObjectPtr aObj, aObjects) {
-    Qt::ItemFlags aFlags = aModel->flags(aModel->objectIndex(aObj));
-    // Check is the object is accessible for editing
-    if ((aFlags & Qt::ItemIsEditable) == 0) {
-      aDeactivate = true;
-      break;
+    if (!aObj->document()->isActive()) {
+      if ((aObj->document() != ModelAPI_Session::get()->moduleDocument()) ||
+           aObj->groupName() == ModelAPI_ResultPart::group()) {
+        aDeactivate = true;
+        break;
+      }
     }
   }
   if (aDeactivate) {