From: nds Date: Fri, 25 Dec 2015 12:37:58 +0000 (+0300) Subject: #1150 Tab buttons problems X-Git-Tag: V_2.1.0~39 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8cd56d486b6e96b8814002f9f0f4acadd6cea11b;p=modules%2Fshaper.git #1150 Tab buttons problems #1112 tab key doesn't work on the last field of left panels Sketch Multi-translation tab for start/end points selection, it should be on number of objects after the end point. Before it, the tab is moved to the start point because the same attribute is used inside it(isCase in activateNextWidget allows this widget) --- diff --git a/src/ModuleBase/ModuleBase_PagedContainer.cpp b/src/ModuleBase/ModuleBase_PagedContainer.cpp index 38b145bfc..9f32442a5 100644 --- a/src/ModuleBase/ModuleBase_PagedContainer.cpp +++ b/src/ModuleBase/ModuleBase_PagedContainer.cpp @@ -22,6 +22,9 @@ ModuleBase_PagedContainer::ModuleBase_PagedContainer(QWidget* theParent, const C : ModuleBase_ModelWidget(theParent, theData, theParentId), myIsFocusOnCurrentPage(false) { + // it is not obligatory to be ignored when property panel tries to activate next active widget + // but if focus is moved to this control, it can accept it. + myIsObligatory = false; } ModuleBase_PagedContainer::~ModuleBase_PagedContainer() diff --git a/src/PartSet/PartSet_SketcherReetntrantMgr.cpp b/src/PartSet/PartSet_SketcherReetntrantMgr.cpp index 8920f8fd9..c04847d5f 100755 --- a/src/PartSet/PartSet_SketcherReetntrantMgr.cpp +++ b/src/PartSet/PartSet_SketcherReetntrantMgr.cpp @@ -211,6 +211,11 @@ bool PartSet_SketcherReetntrantMgr::processEnter(const std::string& thePreviousA if (!isActiveMgr()) return isDone; + // 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 (thePreviousAttributeID.empty()) + return isDone; + ModuleBase_OperationFeature* aFOperation = dynamic_cast (myWorkshop->currentOperation()); if (!myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty()) @@ -218,9 +223,7 @@ bool PartSet_SketcherReetntrantMgr::processEnter(const std::string& thePreviousA bool isSketchSolverError = module()->sketchMgr()->sketchSolverError(); - // 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()) { + if (!isSketchSolverError) { myRestartingMode = RM_EmptyFeatureUsed; isDone = startInternalEdit(thePreviousAttributeID); } diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index 52fa70e11..e2ffb4d1d 100755 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -118,7 +118,7 @@ void XGUI_PropertyPanel::setModelWidgets(const QList& t connect(aWidget, SIGNAL(focusInWidget(ModuleBase_ModelWidget*)), this, SLOT(activateWidget(ModuleBase_ModelWidget*))); connect(aWidget, SIGNAL(focusOutWidget(ModuleBase_ModelWidget*)), - this, SLOT(activateNextWidget(ModuleBase_ModelWidget*))); + this, SLOT(onActivateNextWidget(ModuleBase_ModelWidget*))); connect(aWidget, SIGNAL(keyReleased(QKeyEvent*)), this, SIGNAL(keyReleased(QKeyEvent*))); connect(aWidget, SIGNAL(enterClicked()), @@ -154,6 +154,25 @@ void XGUI_PropertyPanel::updateContentWidget(FeaturePtr theFeature) } void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget) +{ + // it is possible that the property panel widgets have not been visualized + // (e.g. on start operation), so it is strictly important to do not check visualized state + activateNextWidget(theWidget, false); +} + +void XGUI_PropertyPanel::onActivateNextWidget(ModuleBase_ModelWidget* theWidget) +{ + // this slot happens when some widget lost focus, the next widget which accepts the focus + // should be shown, so the second parameter is true + // it is important for features where in cases the same attributes are used, isCase for this + // attribute returns true, however it can be placed in hidden stack widget(extrusion: elements, + // sketch multi rotation -> single/full point) + activateNextWidget(theWidget, true); +} + + +void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget, + const bool isCheckVisibility) { // TO CHECK: Editing operation does not have automatical activation of widgets if (isEditingMode()) { @@ -171,6 +190,10 @@ void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget) if (!aValidators->isCase(aCurrentWidget->feature(), aCurrentWidget->attributeID())) continue; // this attribute is not participated in the current case + if (isCheckVisibility) { + if (!aCurrentWidget->isVisible()) + continue; + } if (!aCurrentWidget->isObligatory()) continue; // not obligatory widgets are not activated automatically @@ -181,6 +204,7 @@ void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget) isFoundWidget = isFoundWidget || (*anIt) == theWidget; } activateWidget(NULL); + //focusNextPrevChild(true); } //#define DEBUG_TAB_WIDGETS @@ -278,7 +302,7 @@ bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext) bool isFirstControl = !theIsNext; QWidget* aLastFocusControl = myActiveWidget->getControlAcceptingFocus(isFirstControl); if (aFocusWidget == aLastFocusControl) { - this->setActiveWidget(NULL); + setActiveWidget(NULL); } } diff --git a/src/XGUI/XGUI_PropertyPanel.h b/src/XGUI/XGUI_PropertyPanel.h index a40ff085b..a73d896dd 100644 --- a/src/XGUI/XGUI_PropertyPanel.h +++ b/src/XGUI/XGUI_PropertyPanel.h @@ -119,6 +119,8 @@ public slots: */ virtual void activateWidget(ModuleBase_ModelWidget* theWidget); + void onActivateNextWidget(ModuleBase_ModelWidget* theWidget); + signals: void enterClicked(); @@ -132,6 +134,12 @@ protected: /// If theIsNext is true, this function searches forward, if next is false, it searches backward. virtual bool focusNextPrevChild(bool theIsNext); + /// Activate the next widget in the property panel + /// \param theWidget a widget. The next widget should be activated + /// \param isCheckVisibility flag whether the next widget visibility is checked + void activateNextWidget(ModuleBase_ModelWidget* theWidget, + const bool isCheckVisibility); + protected: /// A method called on the property panel closed /// \param theEvent a close event