]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Activate part on mouse double click.
authorvsv <vitaly.smetannikov@opencascade.com>
Mon, 15 Sep 2014 08:00:09 +0000 (12:00 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Mon, 15 Sep 2014 08:00:09 +0000 (12:00 +0400)
src/XGUI/XGUI_DocumentDataModel.cpp
src/XGUI/XGUI_ObjectsBrowser.cpp

index feb3c0b5e9a4e18fb3ea966952e6e80603fdfd1e..d74163c715332aaa640744424b5ac46d05a98198 100644 (file)
@@ -477,7 +477,7 @@ bool XGUI_DocumentDataModel::activatedIndex(const QModelIndex& theIndex)
           myActivePart->setItemsColor(ACTIVE_COLOR);
           myModel->setItemsColor(PASSIVE_COLOR);
         } else
-        myModel->setItemsColor(ACTIVE_COLOR);
+          myModel->setItemsColor(ACTIVE_COLOR);
         return true;
       }
     }
index 9cd3bc933ddd928ceb7b80b0b559e6704740e7df..9325c8afbc67509ffe08bfeb8502e6b91284a7e5 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);