From: vsv Date: Wed, 15 Apr 2015 15:33:57 +0000 (+0300) Subject: Issue #459: Selection has to be cleared in Object Browser also on clearing selection... X-Git-Tag: V_1.1.0~23^2~17^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ea32a5952f237961b758e4cc34968902b8629d95;p=modules%2Fshaper.git Issue #459: Selection has to be cleared in Object Browser also on clearing selection in viewer --- diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index 4d3d50d2b..c74b323b8 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -267,9 +267,10 @@ void ModuleBase_WidgetMultiSelector::onSelectionTypeChanged() { activateShapeSelection(); QObjectPtrList anEmptyList; + // This method will call Selection changed event which will call onSelectionChanged + // To clear mySelection, myListControl and storeValue() + // So, we don't need to call it myWorkshop->setSelected(anEmptyList); - // Clear mySelection, myListControl and storeValue() - onSelectionChanged(); } //******************************************************************** diff --git a/src/XGUI/XGUI_ModuleConnector.cpp b/src/XGUI/XGUI_ModuleConnector.cpp index fdc407f7b..d3a057beb 100644 --- a/src/XGUI/XGUI_ModuleConnector.cpp +++ b/src/XGUI/XGUI_ModuleConnector.cpp @@ -104,7 +104,11 @@ ObjectPtr XGUI_ModuleConnector::findPresentedObject(const AISObjectPtr& theAIS) void XGUI_ModuleConnector::setSelected(const QObjectPtrList& theFeatures) { XGUI_Displayer* aDisp = myWorkshop->displayer(); - aDisp->setSelected(theFeatures); + if (theFeatures.isEmpty()) { + myWorkshop->selector()->clearSelection(); + } else { + aDisp->setSelected(theFeatures); + } } bool XGUI_ModuleConnector::canStartOperation(QString theId) diff --git a/src/XGUI/XGUI_SelectionMgr.cpp b/src/XGUI/XGUI_SelectionMgr.cpp index 830417972..84d032590 100644 --- a/src/XGUI/XGUI_SelectionMgr.cpp +++ b/src/XGUI/XGUI_SelectionMgr.cpp @@ -111,34 +111,15 @@ void XGUI_SelectionMgr::onViewerSelection() } //************************************************************** -/*QFeatureList XGUI_SelectionMgr::selectedFeatures() const - { - return myWorkshop->objectBrowser()->selectedFeatures(); - } - - //************************************************************** - QModelIndexList XGUI_SelectionMgr::selectedIndexes() const - { - return myWorkshop->objectBrowser()->selectedIndexes(); - } - - //************************************************************** - void XGUI_SelectionMgr::selectedAISObjects(AIS_ListOfInteractive& theList) const - { - Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); - theList.Clear(); - for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) - theList.Append(aContext->SelectedInteractive()); - } - - //************************************************************** - void XGUI_SelectionMgr::selectedShapes(NCollection_List& theList) const - { - theList.Clear(); - Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); - for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) { - TopoDS_Shape aShape = aContext->SelectedShape(); - if (!aShape.IsNull()) - theList.Append(aShape); - } - }*/ +void XGUI_SelectionMgr::clearSelection() +{ + QObjectPtrList aFeatures; + bool aBlocked = myWorkshop->objectBrowser()->blockSignals(true); + myWorkshop->objectBrowser()->setObjectsSelected(aFeatures); + myWorkshop->objectBrowser()->blockSignals(aBlocked); + + XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + aDisplayer->setSelected(aFeatures); + + emit selectionChanged(); +} diff --git a/src/XGUI/XGUI_SelectionMgr.h b/src/XGUI/XGUI_SelectionMgr.h index 98755ea20..a38546fa0 100644 --- a/src/XGUI/XGUI_SelectionMgr.h +++ b/src/XGUI/XGUI_SelectionMgr.h @@ -50,6 +50,9 @@ Q_OBJECT /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly void updateSelectedOwners(bool isUpdateViewer); + //! Clears selection in Viewer and object Browser + void clearSelection(); + signals: //! Emited when selection in a one of viewers was changed void selectionChanged();