From 45314f99ce0639af40401746aab4917f076102f2 Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 23 Dec 2015 12:06:21 +0300 Subject: [PATCH] #1145 synchronization between object browser and viewer is lost --- src/XGUI/XGUI_SelectionMgr.cpp | 11 +++++++++++ src/XGUI/XGUI_SelectionMgr.h | 5 +++++ src/XGUI/XGUI_Workshop.cpp | 8 ++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/XGUI/XGUI_SelectionMgr.cpp b/src/XGUI/XGUI_SelectionMgr.cpp index 770cc5935..ad92b420b 100644 --- a/src/XGUI/XGUI_SelectionMgr.cpp +++ b/src/XGUI/XGUI_SelectionMgr.cpp @@ -120,6 +120,17 @@ void XGUI_SelectionMgr::onViewerSelection() emit selectionChanged(); } +//************************************************************** +void XGUI_SelectionMgr::updateSelectionBy(const ModuleBase_ISelection::SelectionPlace& thePlace) +{ + QList aSelectedPrs = + myWorkshop->selector()->selection()->getSelected(thePlace); + if (thePlace == ModuleBase_ISelection::Browser) { + XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + aDisplayer->setSelected(aSelectedPrs); + } + +} //************************************************************** void XGUI_SelectionMgr::clearSelection() { diff --git a/src/XGUI/XGUI_SelectionMgr.h b/src/XGUI/XGUI_SelectionMgr.h index a38546fa0..441b52d64 100644 --- a/src/XGUI/XGUI_SelectionMgr.h +++ b/src/XGUI/XGUI_SelectionMgr.h @@ -5,6 +5,7 @@ #include "XGUI.h" #include +#include #include #include @@ -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(); diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index b00dcf471..60fe451c6 100755 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -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") -- 2.39.2