From 8dde253cea9240dbce8c9055e2e159f503a29c3c Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 20 Oct 2015 13:09:08 +0300 Subject: [PATCH] Update Apply button for a point widget, do not activate the same widget(regression). --- src/PartSet/PartSet_WidgetPoint2d.cpp | 2 +- src/XGUI/XGUI_OperationMgr.cpp | 6 +----- src/XGUI/XGUI_PropertyPanel.cpp | 19 ++++++++++--------- src/XGUI/XGUI_PropertyPanel.h | 2 +- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index 7cdf8cc92..9fbffa98c 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -486,7 +486,7 @@ bool PartSet_WidgetPoint2D::processEnter() bool isModified = myXSpin->isModified() || myYSpin->isModified(); if (isModified) { bool isXModified = myXSpin->isModified(); - emit valuesChanged(); + onValuesChanged(); myXSpin->clearModified(); myYSpin->clearModified(); if (isXModified) diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index cc3fe0521..59ad78bf3 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -421,8 +421,6 @@ void XGUI_OperationMgr::onOperationStopped() bool XGUI_OperationMgr::onKeyReleased(QKeyEvent* theEvent) { - qDebug("XGUI_OperationMgr::onKeyReleased"); - QObject* aSender = sender(); // Let the manager decide what to do with the given key combination. @@ -431,7 +429,6 @@ bool XGUI_OperationMgr::onKeyReleased(QKeyEvent* theEvent) switch (theEvent->key()) { case Qt::Key_Return: case Qt::Key_Enter: { - qDebug("XGUI_OperationMgr::onKeyReleased: Key_Return"); ModuleBase_Operation* aOperation = currentOperation(); ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel(); ModuleBase_ModelWidget* aActiveWgt = aPanel->activeWidget(); @@ -444,9 +441,8 @@ bool XGUI_OperationMgr::onKeyReleased(QKeyEvent* theEvent) else isAccepted = false; } - //else - // isAccepted = false; } + break; case Qt::Key_N: case Qt::Key_P: { bool noModifiers = (theEvent->modifiers() == Qt::NoModifier); diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index 4154cfb68..5a4dda830 100644 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -244,21 +244,21 @@ void XGUI_PropertyPanel::activateNextWidget() void XGUI_PropertyPanel::activateWidget(ModuleBase_ModelWidget* theWidget) { // Avoid activation of already actve widget. It could happen on focusIn event many times - setActiveWidget(theWidget); - - if (myActiveWidget) { - emit widgetActivated(myActiveWidget); - } else if (!isEditingMode()) { - emit noMoreWidgets(); - setFocusOnOkButton(); + if (setActiveWidget(theWidget)) { + if (myActiveWidget) { + emit widgetActivated(myActiveWidget); + } else if (!isEditingMode()) { + emit noMoreWidgets(); + setFocusOnOkButton(); + } } } -void XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget* theWidget) +bool XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget* theWidget) { // Avoid activation of already actve widget. It could happen on focusIn event many times if (theWidget == myActiveWidget) { - return; + return false; } if(myActiveWidget) { myActiveWidget->deactivate(); @@ -270,6 +270,7 @@ void XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget* theWidget) theWidget->activate(); } myActiveWidget = theWidget; + return true; } void XGUI_PropertyPanel::setFocusOnOkButton() diff --git a/src/XGUI/XGUI_PropertyPanel.h b/src/XGUI/XGUI_PropertyPanel.h index d916f4f64..fe6eb0ec8 100644 --- a/src/XGUI/XGUI_PropertyPanel.h +++ b/src/XGUI/XGUI_PropertyPanel.h @@ -119,7 +119,7 @@ Q_OBJECT protected: /// Makes the widget active, deactivate the previous, activate and hightlight the given one /// \param theWidget a widget - void setActiveWidget(ModuleBase_ModelWidget* theWidget); + bool setActiveWidget(ModuleBase_ModelWidget* theWidget); /// The parent method that processes the "Tab"/"SHIF + Tab" keyboard events /// Emits a signal about focus change -- 2.39.2