From: Ekaterina Sukhareva Date: Fri, 2 Feb 2024 15:08:01 +0000 (+0000) Subject: [CEA] Select feature/results by double-click X-Git-Tag: V9_13_0a1~20 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d1573bd4d5c0872086f042e66fee3efdee501d45;p=modules%2Fshaper.git [CEA] Select feature/results by double-click --- diff --git a/src/XGUI/XGUI_ObjectsBrowser.cpp b/src/XGUI/XGUI_ObjectsBrowser.cpp index 526cf341f..56a1407cc 100644 --- a/src/XGUI/XGUI_ObjectsBrowser.cpp +++ b/src/XGUI/XGUI_ObjectsBrowser.cpp @@ -26,6 +26,11 @@ #include #include #include +#include +#include +#include +#include +#include #include #include @@ -195,6 +200,32 @@ void XGUI_DataTree::mouseReleaseEvent(QMouseEvent* theEvent) } } +void XGUI_DataTree::highlightDependencies(const QModelIndex& theIndex) +{ + XGUI_ObjectsBrowser* aObjBrowser = qobject_cast(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; diff --git a/src/XGUI/XGUI_ObjectsBrowser.h b/src/XGUI/XGUI_ObjectsBrowser.h index cd9901c0a..9981232d7 100644 --- a/src/XGUI/XGUI_ObjectsBrowser.h +++ b/src/XGUI/XGUI_ObjectsBrowser.h @@ -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);