From f8aca5f52c10e3ed8df8d811df7983d88057418b 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 | 20 ++++++++++---------- src/XGUI/XGUI_PropertyPanel.h | 2 +- 4 files changed, 13 insertions(+), 17 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 5da8053b0..6732dec51 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -498,8 +498,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. @@ -508,7 +506,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(); @@ -521,9 +518,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 994193c26..b5749c7ae 100755 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -241,21 +241,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(); @@ -267,7 +267,7 @@ void XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget* theWidget) theWidget->activate(); } myActiveWidget = theWidget; - setFocusOnOkButton(); + return true; } void XGUI_PropertyPanel::setFocusOnOkButton() diff --git a/src/XGUI/XGUI_PropertyPanel.h b/src/XGUI/XGUI_PropertyPanel.h index a85af1e09..9e6c38592 100644 --- a/src/XGUI/XGUI_PropertyPanel.h +++ b/src/XGUI/XGUI_PropertyPanel.h @@ -123,7 +123,7 @@ public slots: 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