Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / XGUI / XGUI_ObjectsBrowser.cpp
index c62643ad065f97a18032baa3b02005e42e80c134..4268115fde4477d1bbe52412c4d440a4ca291c04 100644 (file)
@@ -57,16 +57,10 @@ void XGUI_DataTree::mouseDoubleClickEvent(QMouseEvent* theEvent)
   if (theEvent->button() == Qt::LeftButton) {
     QModelIndex aIndex = currentIndex();
     XGUI_DocumentDataModel* aModel = dataModel();
-
-    if ((aModel->activePartIndex() != aIndex) && aModel->activePartIndex().isValid()) {
-      setExpanded(aModel->activePartIndex(), false);
-    }
-    bool isChanged = aModel->activatedIndex(aIndex);
-    QTreeView::mouseDoubleClickEvent(theEvent);
-    if (isChanged) {
-      if (aModel->activePartIndex().isValid())
-        setExpanded(aIndex, true);
-      emit activePartChanged(aModel->activePart());
+    ObjectPtr aObject = aModel->object(aIndex);
+    ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
+    if (aPart) {
+      aPart->activate();
     }
   } else
     QTreeView::mouseDoubleClickEvent(theEvent);
@@ -266,7 +260,7 @@ void XGUI_ObjectsBrowser::activatePart(const ResultPartPtr& thePart)
 void XGUI_ObjectsBrowser::onContextMenuRequested(QContextMenuEvent* theEvent)
 {
   myObjectsList = myTreeView->selectedObjects();
-  bool toEnable = myObjectsList.size() > 0;
+  bool toEnable = myObjectsList.size() == 1;
   foreach(QAction* aCmd, actions())
   {
     aCmd->setEnabled(toEnable);
@@ -348,3 +342,9 @@ void XGUI_ObjectsBrowser::setObjectsSelected(const QList<ObjectPtr>& theObjects)
     }
   }
 }
+
+//***************************************************
+void XGUI_ObjectsBrowser::processEvent(const boost::shared_ptr<Events_Message>& theMessage)
+{ 
+  myDocModel->processEvent(theMessage); 
+}