From: nds Date: Fri, 25 Dec 2015 09:14:25 +0000 (+0300) Subject: #1150 Tab buttons problems X-Git-Tag: V_2.1.0~40 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cb2e1bd99bb82effe13e196ef531b55ab43a4ebc;p=modules%2Fshaper.git #1150 Tab buttons problems #1112 tab key doesn't work on the last field of left panels --- 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;