From 5f34f68de0de91d625e0ea079bf9fe0a7b38a488 Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 13 Dec 2017 09:03:55 +0300 Subject: [PATCH] Activation objects redesign : property panel selector is activated by propertyPanelActivated(not widgetActivated as it is not emitted in some case). Problem: Start extrusion, sketch face can not be selected. --- src/XGUI/XGUI_PropertyPanel.cpp | 22 ++++++++++++---------- src/XGUI/XGUI_PropertyPanel.h | 7 +++++-- src/XGUI/XGUI_PropertyPanelSelector.cpp | 2 +- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index bab01f751..f2531ef37 100755 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -436,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); } } @@ -464,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) { @@ -491,8 +486,6 @@ bool XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget* theWidget) theWidget->activate(); } myActiveWidget = theWidget; - myOperationMgr->workshop()->selectionActivate()->updateSelectionModes(); - myOperationMgr->workshop()->selectionActivate()->updateSelectionFilters(); #ifdef DEBUG_ACTIVE_WIDGET std::cout << "myActiveWidget = " << (theWidget ? theWidget->context().c_str() : "") << std::endl; @@ -500,6 +493,15 @@ bool XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget* theWidget) 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); + } + } + emit propertyPanelActivated(); + myOperationMgr->workshop()->selectionActivate()->updateSelectionModes(); + myOperationMgr->workshop()->selectionActivate()->updateSelectionFilters(); return true; } diff --git a/src/XGUI/XGUI_PropertyPanel.h b/src/XGUI/XGUI_PropertyPanel.h index d2b5b4966..fe16ed115 100644 --- a/src/XGUI/XGUI_PropertyPanel.h +++ b/src/XGUI/XGUI_PropertyPanel.h @@ -163,13 +163,16 @@ signals: /// \param theObject a sender of the event void enterClicked(QObject* theObject); - /// Emits on clear content + /// Emits on deactivating property panel (e.g. by clearContent) void propertyPanelDeactivated(); + /// Emits on widget activating + void propertyPanelActivated(); protected: /// Makes the widget active, deactivate the previous, activate and hightlight the given one /// \param theWidget a widget - bool setActiveWidget(ModuleBase_ModelWidget* theWidget); + /// \param isEmitSignal flag whether panel signals should be emitted + bool setActiveWidget(ModuleBase_ModelWidget* theWidget, const bool isEmitSignal); /// The parent method that processes the "Tab"/"SHIF + Tab" keyboard events /// Emits a signal about focus change /// If theIsNext is true, this function searches forward, if next is false, it searches backward. diff --git a/src/XGUI/XGUI_PropertyPanelSelector.cpp b/src/XGUI/XGUI_PropertyPanelSelector.cpp index 503916836..d40f416d7 100644 --- a/src/XGUI/XGUI_PropertyPanelSelector.cpp +++ b/src/XGUI/XGUI_PropertyPanelSelector.cpp @@ -25,7 +25,7 @@ XGUI_PropertyPanelSelector::XGUI_PropertyPanelSelector(XGUI_PropertyPanel* thePanel) : myPanel(thePanel), myWidgetToBeActivated (NULL) { - connect(myPanel, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)), this, SIGNAL(activated())); + connect(myPanel, SIGNAL(propertyPanelActivated()), this, SIGNAL(activated())); connect(myPanel, SIGNAL(propertyPanelDeactivated()), this, SIGNAL(deactivated())); } -- 2.39.2