From 88c4a5c85a8d2cfab598c69882b9ceae15507123 Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 13 Dec 2017 16:20:33 +0300 Subject: [PATCH] Issue #2365 problem with active panel in feature and Hide faces windows --- .../ModuleBase_ISelectionActivate.h | 4 ---- src/PartSet/PartSet_SketcherReentrantMgr.cpp | 7 +------ src/XGUI/XGUI_ActiveControlMgr.cpp | 5 ++--- src/XGUI/XGUI_PropertyPanel.cpp | 5 ++++- src/XGUI/XGUI_PropertyPanelSelector.cpp | 20 +++++++++++-------- src/XGUI/XGUI_SelectionActivate.cpp | 14 ------------- src/XGUI/XGUI_SelectionActivate.h | 4 ---- 7 files changed, 19 insertions(+), 40 deletions(-) diff --git a/src/ModuleBase/ModuleBase_ISelectionActivate.h b/src/ModuleBase/ModuleBase_ISelectionActivate.h index 4e79670b4..c730d7be8 100644 --- a/src/ModuleBase/ModuleBase_ISelectionActivate.h +++ b/src/ModuleBase/ModuleBase_ISelectionActivate.h @@ -54,10 +54,6 @@ public: MODULEBASE_EXPORT virtual void activateSelectionFilters (const SelectMgr_ListOfFilter& theSelectionFilters) = 0; - /// Activate or deactivate selection and selection filters like the widget is active - /// \param theWidget a source widget of selection modes/filters - MODULEBASE_EXPORT virtual void activateSelectionAndFilters(ModuleBase_ModelWidget* theWidget) = 0; - protected: ModuleBase_IWorkshop* myWorkshop; ///< active workshop }; diff --git a/src/PartSet/PartSet_SketcherReentrantMgr.cpp b/src/PartSet/PartSet_SketcherReentrantMgr.cpp index fbda12947..d987f86f7 100644 --- a/src/PartSet/PartSet_SketcherReentrantMgr.cpp +++ b/src/PartSet/PartSet_SketcherReentrantMgr.cpp @@ -660,13 +660,8 @@ void PartSet_SketcherReentrantMgr::deleteInternalFeature() std::cout << "PartSet_SketcherReentrantMgr::deleteInternalFeature: " << myInternalFeature->data()->name() << std::endl; #endif - if (myInternalActiveWidget) { - ModuleBase_WidgetSelector* aWSelector = - dynamic_cast(myInternalActiveWidget); - if (aWSelector) - myWorkshop->selectionActivate()->activateSelectionAndFilters(aWSelector); + if (myInternalActiveWidget) myInternalActiveWidget = 0; - } delete myInternalWidget; myInternalWidget = 0; diff --git a/src/XGUI/XGUI_ActiveControlMgr.cpp b/src/XGUI/XGUI_ActiveControlMgr.cpp index 13c789c25..629ac6d8d 100644 --- a/src/XGUI/XGUI_ActiveControlMgr.cpp +++ b/src/XGUI/XGUI_ActiveControlMgr.cpp @@ -76,13 +76,12 @@ void XGUI_ActiveControlMgr::onSelectorActivated() void XGUI_ActiveControlMgr::onSelectorDeactivated() { XGUI_ActiveControlSelector* aSelector = qobject_cast(sender()); - if (!aSelector) + if (!aSelector || aSelector != myActiveSelector || !myActiveSelector) return; + myActiveSelector->setActive(false); myActiveSelector = NULL; - aSelector->setActive(false); - XGUI_ActiveControlSelector* aSelectorToBeActivated = 0; for (int i = 0, aCount = mySelectors.count(); i < aCount; i++) { diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index e46ab2d5b..b878d62c5 100755 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -499,7 +499,10 @@ bool XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget* theWidget, cons emit noMoreWidgets(aPreviosAttributeID); } } - emit propertyPanelActivated(); + if (myActiveWidget) + emit propertyPanelActivated(); + else + emit propertyPanelDeactivated(); myOperationMgr->workshop()->selectionActivate()->updateSelectionModes(); myOperationMgr->workshop()->selectionActivate()->updateSelectionFilters(); return true; diff --git a/src/XGUI/XGUI_PropertyPanelSelector.cpp b/src/XGUI/XGUI_PropertyPanelSelector.cpp index d40f416d7..30fc0f9b2 100644 --- a/src/XGUI/XGUI_PropertyPanelSelector.cpp +++ b/src/XGUI/XGUI_PropertyPanelSelector.cpp @@ -38,17 +38,21 @@ void XGUI_PropertyPanelSelector::reset() //******************************************************************** void XGUI_PropertyPanelSelector::setActive(const bool& isActive) { - if (isActive) { - if (myWidgetToBeActivated) - myPanel->activateWidget(myWidgetToBeActivated, true); + if (isActive && myWidgetToBeActivated) { + // e.g. widget sketch label + myPanel->activateWidget(myWidgetToBeActivated, true); + myWidgetToBeActivated = NULL; return; } - ModuleBase_ModelWidget* aWidget = myPanel->activeWidget(); - if (aWidget && aWidget->needToBeActiated()) - { - myWidgetToBeActivated = aWidget; + + if (!isActive) { // on deactivating, store previous active widget + ModuleBase_ModelWidget* aWidget = myPanel->activeWidget(); + if (aWidget && aWidget->needToBeActiated()) + { + myWidgetToBeActivated = aWidget; + } + myPanel->activateWidget(NULL, false); } - myPanel->activateWidget(NULL, false); } //******************************************************************** diff --git a/src/XGUI/XGUI_SelectionActivate.cpp b/src/XGUI/XGUI_SelectionActivate.cpp index 9b8d2a5d5..af1855f56 100644 --- a/src/XGUI/XGUI_SelectionActivate.cpp +++ b/src/XGUI/XGUI_SelectionActivate.cpp @@ -136,20 +136,6 @@ void XGUI_SelectionActivate::activateSelectionFilters } } -//************************************************************** -void XGUI_SelectionActivate::activateSelectionAndFilters(ModuleBase_ModelWidget* theWidget) -{ - // activate selection modes - QIntList aModes; - getSelectionModes(theWidget, aModes); - activateObjects(aModes, getDisplayer()->displayedObjects(), true); - - // activate selection filters - SelectMgr_ListOfFilter aSelectionFilters; - getSelectionFilters(theWidget, aSelectionFilters); - activateSelectionFilters(aSelectionFilters); -} - //************************************************************** void XGUI_SelectionActivate::getSelectionModes(ModuleBase_ModelWidget* theWidget, QIntList& theModes) diff --git a/src/XGUI/XGUI_SelectionActivate.h b/src/XGUI/XGUI_SelectionActivate.h index 9795c48d9..89c12fcaa 100644 --- a/src/XGUI/XGUI_SelectionActivate.h +++ b/src/XGUI/XGUI_SelectionActivate.h @@ -133,10 +133,6 @@ public: XGUI_EXPORT void deactivateTrihedronInSelectionModes(); protected: - /// Activate or deactivate selection and selection filters like the widget is active - /// \param theWidget a source widget of selection modes/filters - virtual void activateSelectionAndFilters(ModuleBase_ModelWidget* theWidget); - /// Returns selection modes of the widget /// \param theWidget model widget /// \param theModes selection modes -- 2.39.2