]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
#1145 synchronization between object browser and viewer is lost
authornds <nds@opencascade.com>
Wed, 23 Dec 2015 09:06:21 +0000 (12:06 +0300)
committernds <nds@opencascade.com>
Wed, 23 Dec 2015 09:06:21 +0000 (12:06 +0300)
src/XGUI/XGUI_SelectionMgr.cpp
src/XGUI/XGUI_SelectionMgr.h
src/XGUI/XGUI_Workshop.cpp

index 770cc593566992380acec624b8119dec3612a43e..ad92b420b0568a91ebf1e53bfbf049e71a6a6231 100644 (file)
@@ -120,6 +120,17 @@ void XGUI_SelectionMgr::onViewerSelection()
   emit selectionChanged();
 }
 
+//**************************************************************
+void XGUI_SelectionMgr::updateSelectionBy(const ModuleBase_ISelection::SelectionPlace& thePlace)
+{
+  QList<ModuleBase_ViewerPrs> aSelectedPrs =
+               myWorkshop->selector()->selection()->getSelected(thePlace);
+  if (thePlace == ModuleBase_ISelection::Browser) {
+    XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+    aDisplayer->setSelected(aSelectedPrs);
+  }
+
+}
 //**************************************************************
 void XGUI_SelectionMgr::clearSelection()
 {
index a38546fa0d88a36ff03d6f9b75cf0715abab1b2e..441b52d6436d825cf512964cee732a08db3dea67 100644 (file)
@@ -5,6 +5,7 @@
 
 #include "XGUI.h"
 #include <ModuleBase_Definitions.h>
+#include <ModuleBase_ISelection.h>
 #include <QObject>
 #include <QModelIndexList>
 
@@ -53,6 +54,10 @@ Q_OBJECT
   //! Clears selection in Viewer and object Browser
   void clearSelection();
 
+  /// Updates selection, which are depend on the selection in the given place
+  /// \thePlace a widget where selection has happened.
+  void updateSelectionBy(const ModuleBase_ISelection::SelectionPlace& thePlace);
+
 signals:
   //! Emited when selection in a one of viewers was changed
   void selectionChanged();
index b00dcf471120d425bb2a27b2f3707c97b21129f8..60fe451c633c6b168decae34a3bbc01adfe89891 100755 (executable)
@@ -1131,12 +1131,16 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
     moveObjects();
   else if (theId == "COLOR_CMD")
     changeColor(aObjects);
-  else if (theId == "SHOW_CMD")
+  else if (theId == "SHOW_CMD") {
     showObjects(aObjects, true);
+    mySelector->updateSelectionBy(ModuleBase_ISelection::Browser);
+  }
   else if (theId == "HIDE_CMD")
     showObjects(aObjects, false);
-  else if (theId == "SHOW_ONLY_CMD")
+  else if (theId == "SHOW_ONLY_CMD") {
     showOnlyObjects(aObjects);
+    mySelector->updateSelectionBy(ModuleBase_ISelection::Browser);
+  }
   else if (theId == "SHADING_CMD")
     setDisplayMode(aObjects, XGUI_Displayer::Shading);
   else if (theId == "WIREFRAME_CMD")