Salome HOME
#1150 Tab buttons problems
authornds <nds@opencascade.com>
Fri, 25 Dec 2015 12:37:58 +0000 (15:37 +0300)
committernds <nds@opencascade.com>
Fri, 25 Dec 2015 12:38:24 +0000 (15:38 +0300)
#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)

src/ModuleBase/ModuleBase_PagedContainer.cpp
src/PartSet/PartSet_SketcherReetntrantMgr.cpp
src/XGUI/XGUI_PropertyPanel.cpp
src/XGUI/XGUI_PropertyPanel.h

index 38b145bfc2f302d504fe629feaf3a2043456fe42..9f32442a577901139b5a810492c2828dc1195cd1 100644 (file)
@@ -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()
index 8920f8fd9a3ce9c2b2b723f9d5f7d5870eedd6b8..c04847d5f6d09ca996bd9e4f981fddb5f45f5325 100755 (executable)
@@ -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<ModuleBase_OperationFeature*>
                                                        (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);
   }
index 52fa70e11bf8d4220e979d9b9db29a1bfb416498..e2ffb4d1d7cbb7dff85d7580d332236984608803 100755 (executable)
@@ -118,7 +118,7 @@ void XGUI_PropertyPanel::setModelWidgets(const QList<ModuleBase_ModelWidget*>& 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);
       }
     }
 
index a40ff085b2ca961b14718c56c870afba7a61adef..a73d896dd31a6cd0cd40cfcb9f0dbb67549f98d8 100644 (file)
@@ -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