]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
[CEA] Select feature/results by double-click 40647_doubleClick 44/head
authorEkaterina Sukhareva <ekaterina.sukhareva@opencascade.com>
Fri, 2 Feb 2024 15:08:01 +0000 (15:08 +0000)
committerEkaterina Sukhareva <ekaterina.sukhareva@opencascade.com>
Fri, 2 Feb 2024 17:02:36 +0000 (17:02 +0000)
src/XGUI/XGUI_ObjectsBrowser.cpp
src/XGUI/XGUI_ObjectsBrowser.h

index 526cf341f81dcdd7d93821db756dbb391bddfd60..56a1407ccc2d282ccb425d7bcabfe28209876866 100644 (file)
 #include <ModelAPI_Document.h>
 #include <ModelAPI_Tools.h>
 #include <ModelAPI_ResultField.h>
+#include <ModelAPI_Feature.h>
+#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_ResultConstruction.h>
+#include <ModelAPI_ResultGroup.h>
+#include <ModelAPI_ResultField.h>
 
 #include <ModuleBase_Tools.h>
 #include <ModuleBase_ITreeNode.h>
@@ -195,6 +200,32 @@ void XGUI_DataTree::mouseReleaseEvent(QMouseEvent* theEvent)
   }
 }
 
+void XGUI_DataTree::highlightDependencies(const QModelIndex& theIndex)
+{
+  XGUI_ObjectsBrowser* aObjBrowser = qobject_cast<XGUI_ObjectsBrowser*>(parent());
+  XGUI_Workshop* aWorkshop = aObjBrowser->workshop();
+
+  XGUI_DataModel* aModel = dataModel();
+  ObjectPtr aObj = aModel->object(theIndex);
+  if(!aObj)
+    return;
+
+  QObjectPtrList anObjs;
+  anObjs.append(aObj);
+  std::string aName = aObj->groupName();
+  if(aName == ModelAPI_ResultBody::group() ||
+     aName == ModelAPI_ResultConstruction::group() ||
+     aName == ModelAPI_ResultGroup::group() ||
+     aName == ModelAPI_ResultField::group())
+  {
+    aWorkshop->highlightFeature(anObjs);
+  }
+  else if(aName == ModelAPI_Feature::group())
+  {
+    aWorkshop->highlightResults(anObjs);
+  }
+}
+
 void XGUI_DataTree::processHistoryChange(const QModelIndex& theIndex)
 {
   SessionPtr aMgr = ModelAPI_Session::get();
@@ -272,6 +303,9 @@ void XGUI_DataTree::processEyeClick(const QModelIndex& theIndex)
 void XGUI_DataTree::onDoubleClick(const QModelIndex& theIndex)
 {
   switch (theIndex.column()) {
+  case 1:
+    highlightDependencies(theIndex);
+    break;
   case 2:
     processHistoryChange(theIndex);
     break;
index cd9901c0a7aaad687a775228680de036423a0ae7..9981232d786ea22916a59aca8f41a5c7126446b8 100644 (file)
@@ -136,6 +136,11 @@ private:
   /// \param theIndex a clicked data index
   void processHistoryChange(const QModelIndex& theIndex);
 
+  /// Highlight parent feature for chosen result or highlight
+  /// result for chosen feature
+  /// \param theIndex a clicked data index
+  void highlightDependencies(const QModelIndex& theIndex);
+
   /// Process a visibility change request
   /// \param theIndex a clicked data index
   void processEyeClick(const QModelIndex& theIndex);