From cb2e1bd99bb82effe13e196ef531b55ab43a4ebc Mon Sep 17 00:00:00 2001 From: nds Date: Fri, 25 Dec 2015 12:14:25 +0300 Subject: [PATCH] #1150 Tab buttons problems #1112 tab key doesn't work on the last field of left panels --- src/ModuleBase/ModuleBase_ModelWidget.cpp | 9 ++++++--- src/PartSet/PartSet_SketcherReetntrantMgr.cpp | 5 ++++- src/XGUI/XGUI_PropertyPanel.cpp | 13 +++++++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/ModuleBase/ModuleBase_ModelWidget.cpp b/src/ModuleBase/ModuleBase_ModelWidget.cpp index fc7beb3e2..f0f959480 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.cpp +++ b/src/ModuleBase/ModuleBase_ModelWidget.cpp @@ -171,7 +171,7 @@ void ModuleBase_ModelWidget::activate() void ModuleBase_ModelWidget::deactivate() { myIsValueStateBlocked = false; - if (myState == ModifiedInPP) + if (myState == ModifiedInPP || myState == ModifiedInViewer) storeValue(); myState = Stored; } @@ -298,8 +298,11 @@ bool ModuleBase_ModelWidget::eventFilter(QObject* theObject, QEvent *theEvent) aReason == Qt::TabFocusReason || aReason == Qt::BacktabFocusReason || aReason == Qt::OtherFocusReason; // to process widget->setFocus() - if (aMouseOrKey && getControls().contains(aWidget) && getValueState() == ModifiedInPP) - storeValue(); + if (aMouseOrKey && getControls().contains(aWidget)) { + if (getValueState() == ModifiedInPP) { + storeValue(); + } + } } // pass the event on to the parent class diff --git a/src/PartSet/PartSet_SketcherReetntrantMgr.cpp b/src/PartSet/PartSet_SketcherReetntrantMgr.cpp index e2e5442d9..8920f8fd9 100755 --- a/src/PartSet/PartSet_SketcherReetntrantMgr.cpp +++ b/src/PartSet/PartSet_SketcherReetntrantMgr.cpp @@ -217,7 +217,10 @@ bool PartSet_SketcherReetntrantMgr::processEnter(const std::string& thePreviousA return isDone; bool isSketchSolverError = module()->sketchMgr()->sketchSolverError(); - if (!isSketchSolverError) { + + // empty previous attribute means that the Apply/Ok button has focus and the enter + // should not lead to start edition mode of the previous operation + if (!isSketchSolverError && !thePreviousAttributeID.empty()) { myRestartingMode = RM_EmptyFeatureUsed; isDone = startInternalEdit(thePreviousAttributeID); } diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index e4b8371cd..52fa70e11 100755 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -183,7 +183,7 @@ void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget) activateWidget(NULL); } -#define DEBUG_TAB_WIDGETS +//#define DEBUG_TAB_WIDGETS #define DEBUG_TAB #ifdef DEBUG_TAB @@ -229,8 +229,8 @@ bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext) // controls, last control, Apply, Cancel, first control, controls bool isChangedFocus = false; -#ifdef DEBUG_TAB_WIDGETS QWidget* aFocusWidget = focusWidget(); +#ifdef DEBUG_TAB_WIDGETS if (aFocusWidget) { QString anInfo = QString("focus Widget: %1").arg(aFocusWidget->objectName()); qDebug(anInfo.toStdString().c_str()); @@ -273,6 +273,15 @@ bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext) } } if (aNewFocusWidget) { + if (myActiveWidget) { + myActiveWidget->getControls(); + bool isFirstControl = !theIsNext; + QWidget* aLastFocusControl = myActiveWidget->getControlAcceptingFocus(isFirstControl); + if (aFocusWidget == aLastFocusControl) { + this->setActiveWidget(NULL); + } + } + //ModuleBase_Tools::setFocus(aNewFocusWidget, "XGUI_PropertyPanel::focusNextPrevChild()"); aNewFocusWidget->setFocus(theIsNext ? Qt::TabFocusReason : Qt::BacktabFocusReason); isChangedFocus = true; -- 2.39.2