]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Hide faces: Sketch operation: selection of sketch plane after deactivation of Hide...
authornds <nds@opencascade.com>
Thu, 14 Dec 2017 08:22:16 +0000 (11:22 +0300)
committernds <nds@opencascade.com>
Thu, 14 Dec 2017 08:22:16 +0000 (11:22 +0300)
src/XGUI/XGUI_ActiveControlMgr.cpp
src/XGUI/XGUI_ActiveControlMgr.h

index 73b7ac61022dac09b4890fac3a285fa64530181d..83d1b04c95f56de69e0f687acd31c47e50f005e1 100644 (file)
 void debugInfo(const QString& theMessage, XGUI_ActiveControlSelector* theSelector)
 {
   std::cout << theMessage.toStdString().c_str() << ", active: "
-    << theSelector ? theSelector->getType().toStdString().c_str() : "NULL" << std::endl;
+    << (theSelector ? theSelector->getType().toStdString().c_str() : "NULL") << std::endl;
 }
 #endif
 
 //********************************************************************
 XGUI_ActiveControlMgr::XGUI_ActiveControlMgr(ModuleBase_IWorkshop* theWorkshop)
-: myWorkshop(theWorkshop), myActiveSelector(0)
+: myWorkshop(theWorkshop), myActiveSelector(0), myIsBlocked(false)
 {
   connect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
 }
@@ -73,9 +73,12 @@ void XGUI_ActiveControlMgr::onSelectorActivated()
   if (!aSelector || aSelector == myActiveSelector)
     return;
 
-  if (myActiveSelector)
+  if (myIsBlocked) // we've come here from the same method
+    return;
+  myIsBlocked = true;
+  if (myActiveSelector) {
     myActiveSelector->setActive(false);
-
+  }
   activateSelector(aSelector);
   XGUI_Tools::workshop(myWorkshop)->selectionActivate()->updateSelectionModes();
   XGUI_Tools::workshop(myWorkshop)->selectionActivate()->updateSelectionFilters();
@@ -83,6 +86,7 @@ void XGUI_ActiveControlMgr::onSelectorActivated()
 #ifdef DEBUG_ACTIVE_SELECTOR
   debugInfo("onSelectorActivated", myActiveSelector);
 #endif
+  myIsBlocked = false;
 }
 
 //********************************************************************
@@ -92,6 +96,10 @@ void XGUI_ActiveControlMgr::onSelectorDeactivated()
   if (!aSelector || aSelector != myActiveSelector || !myActiveSelector)
     return;
 
+  if (myIsBlocked) // we've come here from the same method
+    return;
+  myIsBlocked = true;
+
   myActiveSelector->setActive(false);
   activateSelector(NULL);
 
@@ -111,6 +119,7 @@ void XGUI_ActiveControlMgr::onSelectorDeactivated()
 #ifdef DEBUG_ACTIVE_SELECTOR
   debugInfo("onSelectorDeactivated", myActiveSelector);
 #endif
+  myIsBlocked = false;
 }
 
 //********************************************************************
index 40355b697953ca2dd4141782faf779ffa848f87e..7b0703a5d598d2e1fa31bb7ac648301a8f8d3a54 100644 (file)
@@ -73,6 +73,8 @@ protected:
 
   QList<XGUI_ActiveControlSelector*> mySelectors; ///< workshop selectors
   XGUI_ActiveControlSelector* myActiveSelector; ///< active selector
+
+  bool myIsBlocked; ///< blocking flag to avoid cycling signals processing
 };
 
 #endif