From: nds Date: Thu, 21 May 2015 05:32:41 +0000 (+0300) Subject: Code improvement: avoid the code duplication for setSelected method in the displayer... X-Git-Tag: V_1.2.0~130 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d11f54b43656fe504e36f548540e919e1cc7cfa4;p=modules%2Fshaper.git Code improvement: avoid the code duplication for setSelected method in the displayer. It gets currently a list of viewer prs instead of a list of objects. This is necessary to restore the shape selection. --- diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index 7c6660344..493a077a2 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -79,12 +79,12 @@ class XGUI_EXPORT XGUI_Displayer: public QObject void redisplay(ObjectPtr theObject, bool isUpdateViewer = true); /** - * Add presentations which corresponds to the given features to current selection - * \param theFeatures a list of features to be selected + * Add presentations to current selection. It unhighlight and deselect the current selection. + * The shape and result components are processed in the values. If the presentation shape is not + * empty, select it, otherwise select the result. + * \param theValues a list of presentation to be selected * \param isUpdateViewer the parameter whether the viewer should be update immediatelly */ - void setSelected(const QObjectPtrList& theFeatures, bool isUpdateViewer = true); - void setSelected(const QList& theValues, bool isUpdateViewer = true); diff --git a/src/XGUI/XGUI_SelectionMgr.cpp b/src/XGUI/XGUI_SelectionMgr.cpp index 84d032590..517f24866 100644 --- a/src/XGUI/XGUI_SelectionMgr.cpp +++ b/src/XGUI/XGUI_SelectionMgr.cpp @@ -87,8 +87,10 @@ void XGUI_SelectionMgr::updateSelectedOwners(bool isUpdateViewer) void XGUI_SelectionMgr::onObjectBrowserSelection() { QObjectPtrList aObjects = myWorkshop->objectBrowser()->selectedObjects(); + QList aSelectedPrs = ModuleBase_ISelection::getViewerPrs(aObjects); + XGUI_Displayer* aDisplayer = myWorkshop->displayer(); - aDisplayer->setSelected(aObjects); + aDisplayer->setSelected(aSelectedPrs); emit selectionChanged(); } @@ -117,9 +119,10 @@ void XGUI_SelectionMgr::clearSelection() bool aBlocked = myWorkshop->objectBrowser()->blockSignals(true); myWorkshop->objectBrowser()->setObjectsSelected(aFeatures); myWorkshop->objectBrowser()->blockSignals(aBlocked); + QList aSelectedPrs = ModuleBase_ISelection::getViewerPrs(aFeatures); XGUI_Displayer* aDisplayer = myWorkshop->displayer(); - aDisplayer->setSelected(aFeatures); + aDisplayer->setSelected(aSelectedPrs); emit selectionChanged(); }