Salome HOME
Issue #2365 problem with active panel in feature and Hide faces windows
[modules/shaper.git] / src / XGUI / XGUI_PropertyPanel.cpp
index cb031c166c80e27d5d86f3ba4f386db686b17d15..b878d62c5ae7011c164762686b26ac0717955c49 100755 (executable)
@@ -20,6 +20,7 @@
 
 #include <XGUI_ActionsMgr.h>
 #include <XGUI_ActiveControlMgr.h>
+#include <XGUI_SelectionActivate.h>
 #include <XGUI_ActiveControlSelector.h>
 #include <XGUI_PropertyPanel.h>
 #include <XGUI_PropertyPanelSelector.h>
@@ -151,6 +152,9 @@ void XGUI_PropertyPanel::cleanContent()
   myWidgets.clear();
   myPanelPage->clearPage();
   myActiveWidget = NULL;
+  emit propertyPanelDeactivated();
+  myOperationMgr->workshop()->selectionActivate()->updateSelectionModes();
+  myOperationMgr->workshop()->selectionActivate()->updateSelectionFilters();
 #ifdef DEBUG_ACTIVE_WIDGET
   std::cout << "myActiveWidget = NULL" << std::endl;
 #endif
@@ -432,7 +436,7 @@ bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext)
       bool isFirstControl = !theIsNext;
       QWidget* aLastFocusControl = myActiveWidget->getControlAcceptingFocus(isFirstControl);
       if (aFocusWidget == aLastFocusControl) {
-        setActiveWidget(NULL);
+        setActiveWidget(NULL, false);
       }
     }
 
@@ -460,15 +464,10 @@ void XGUI_PropertyPanel::activateWidget(ModuleBase_ModelWidget* theWidget, const
     aPreviosAttributeID = myActiveWidget->attributeID();
 
   // Avoid activation of already actve widget. It could happen on focusIn event many times
-  if (setActiveWidget(theWidget) && theEmitSignal) {
-    emit widgetActivated(myActiveWidget);
-    if (!myActiveWidget && !isEditingMode()) {
-      emit noMoreWidgets(aPreviosAttributeID);
-    }
-  }
+  setActiveWidget(theWidget, theEmitSignal);
 }
 
-bool XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget* theWidget)
+bool XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget* theWidget, const bool isEmitSignal)
 {
   // Avoid activation of already actve widget. It could happen on focusIn event many times
   if (theWidget == myActiveWidget) {
@@ -487,12 +486,25 @@ bool XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget* theWidget)
     theWidget->activate();
   }
   myActiveWidget = theWidget;
+
 #ifdef DEBUG_ACTIVE_WIDGET
   std::cout << "myActiveWidget = " << (theWidget ? theWidget->context().c_str() : "") << std::endl;
 #endif
   static Events_ID anEvent = Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION);
   Events_Loop::loop()->flush(anEvent);
 
+  if (isEmitSignal) {
+    //emit widgetActivated(myActiveWidget);
+    if (!myActiveWidget && !isEditingMode()) {
+      emit noMoreWidgets(aPreviosAttributeID);
+    }
+  }
+  if (myActiveWidget)
+    emit propertyPanelActivated();
+  else
+    emit propertyPanelDeactivated();
+  myOperationMgr->workshop()->selectionActivate()->updateSelectionModes();
+  myOperationMgr->workshop()->selectionActivate()->updateSelectionFilters();
   return true;
 }