]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #459: Selection has to be cleared in Object Browser also on clearing selection...
authorvsv <vitaly.smetannikov@opencascade.com>
Wed, 15 Apr 2015 15:33:57 +0000 (18:33 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Wed, 15 Apr 2015 15:33:57 +0000 (18:33 +0300)
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/XGUI/XGUI_ModuleConnector.cpp
src/XGUI/XGUI_SelectionMgr.cpp
src/XGUI/XGUI_SelectionMgr.h

index 4d3d50d2b8b1bbb80f7d18d8e94a189a1d858cd1..c74b323b83b6f038769f71032f5418ff79a0c24e 100644 (file)
@@ -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();
 }
 
 //********************************************************************
index fdc407f7be5fa95b5a577b800f2748d43d346f16..d3a057beb5111d865a7f09285d809bc1d5460c20 100644 (file)
@@ -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)
index 8304179726f246d4106c5cef7f06256dd71a53b5..84d03259006a4f449ebae4ce90457ab97101ddd2 100644 (file)
@@ -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<TopoDS_Shape>& 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();
+}
index 98755ea20078afe8f50a0c7a001a35100a837376..a38546fa0d88a36ff03d6f9b75cf0715abab1b2e 100644 (file)
@@ -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();