Salome HOME
Update viewer after selection clear for OCCT 7.4.0.
[modules/shaper.git] / src / XGUI / XGUI_SelectionMgr.cpp
index 78b20ee7d68cdf9a6d0dd07c4e0d2ccd9d076614..49bcdcbd375174e0c6ad221b217250cf38c26ad8 100644 (file)
@@ -40,6 +40,7 @@
 #include <ModelAPI_Object.h>
 #include <ModelAPI_ResultBody.h>
 #include <ModelAPI_Tools.h>
+#include <ModelAPI_ResultField.h>
 
 #include <GeomAPI_Shape.h>
 
@@ -105,6 +106,7 @@ void XGUI_SelectionMgr::setSelectedOwners(const SelectMgr_IndexedMapOfOwner& the
 //**************************************************************
 void XGUI_SelectionMgr::onObjectBrowserSelection()
 {
+  myLastSelectionPlace = ModuleBase_ISelection::Browser;
   QList<ModuleBase_ViewerPrsPtr> aSelectedPrs =
     myWorkshop->selector()->selection()->getSelected(ModuleBase_ISelection::Browser);
   XGUI_Displayer* aDisplayer = myWorkshop->displayer();
@@ -130,17 +132,24 @@ void XGUI_SelectionMgr::onObjectBrowserSelection()
     }
   }
   aDisplayer->setSelected(aSelectedPrs);
+  myWorkshop->updateColorScaleVisibility();
   emit selectionChanged();
 }
 
 //**************************************************************
 void XGUI_SelectionMgr::onViewerSelection()
 {
+  myLastSelectionPlace = ModuleBase_ISelection::Viewer;
   QList<ModuleBase_ViewerPrsPtr> aValues;
   Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
-  if (!aContext.IsNull())
+  if (!aContext.IsNull()) {
     aValues = selection()->getSelected(ModuleBase_ISelection::Viewer);
-
+    // Update is necessary for OCCT 7.4.0: when it is clears selection it doesn't updates viewer
+#if OCC_VERSION_HEX == 0x070400
+    if (aValues.isEmpty())
+      aContext->UpdateCurrentViewer();
+#endif
+  }
   QObjectPtrList anObjects;
   convertToObjectBrowserSelection(aValues, anObjects);
   myWorkshop->objectBrowser()->setObjectsSelected(anObjects);