From cf408f7f9c53f7527ce19c217b33c3dbccbb3a97 Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 14 Dec 2017 11:22:16 +0300 Subject: [PATCH] Hide faces: Sketch operation: selection of sketch plane after deactivation of Hide faces panel. --- src/XGUI/XGUI_ActiveControlMgr.cpp | 17 +++++++++++++---- src/XGUI/XGUI_ActiveControlMgr.h | 2 ++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/XGUI/XGUI_ActiveControlMgr.cpp b/src/XGUI/XGUI_ActiveControlMgr.cpp index 73b7ac610..83d1b04c9 100644 --- a/src/XGUI/XGUI_ActiveControlMgr.cpp +++ b/src/XGUI/XGUI_ActiveControlMgr.cpp @@ -33,13 +33,13 @@ 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; } //******************************************************************** diff --git a/src/XGUI/XGUI_ActiveControlMgr.h b/src/XGUI/XGUI_ActiveControlMgr.h index 40355b697..7b0703a5d 100644 --- a/src/XGUI/XGUI_ActiveControlMgr.h +++ b/src/XGUI/XGUI_ActiveControlMgr.h @@ -73,6 +73,8 @@ protected: QList mySelectors; ///< workshop selectors XGUI_ActiveControlSelector* myActiveSelector; ///< active selector + + bool myIsBlocked; ///< blocking flag to avoid cycling signals processing }; #endif -- 2.39.2