Salome HOME
Apply button accepts the focus after last control in the Property panel. Controls...
authornds <nds@opencascade.com>
Wed, 14 Oct 2015 12:30:14 +0000 (15:30 +0300)
committernds <nds@opencascade.com>
Wed, 14 Oct 2015 12:30:40 +0000 (15:30 +0300)
src/PartSet/PartSet_WidgetPoint2DFlyout.h
src/XGUI/XGUI_PropertyPanel.cpp

index 3c294d3b50d5dc079ed908217e7dad763ef7d8a8..cbcdc473fc17bba5d2917f5e7471892e67716e6c 100755 (executable)
@@ -8,7 +8,7 @@
 #define PartSet_WidgetPoint2DFlyout_H
 
 #include "PartSet.h"
-#include <PartSet_WidgetPoint2D.h>
+#include <PartSet_WidgetPoint2d.h>
 
 class XGUI_Workshop;
 
index 637521cb7a5103fa0fa896dc95c81f36130df86b..3838f78868d384e056105fdf810ee01a6d28aeef 100644 (file)
@@ -119,19 +119,23 @@ void XGUI_PropertyPanel::setModelWidgets(const QList<ModuleBase_ModelWidget*>& t
     connect(aWidget, SIGNAL(keyReleased(QKeyEvent*)),
             this,    SIGNAL(keyReleased(QKeyEvent*)));
   }
-  ModuleBase_ModelWidget* aLastWidget = theWidgets.last();
-  if (aLastWidget) {
-    QList<QWidget*> aControls = aLastWidget->getControls();
-    if (!aControls.empty()) {
-      QWidget* aLastControl = aControls.last();
 
-      QToolButton* anOkBtn = findChild<QToolButton*>(PROP_PANEL_OK);
-      QToolButton* aCancelBtn = findChild<QToolButton*>(PROP_PANEL_CANCEL);
-
-      setTabOrder(aLastControl, anOkBtn);
-      setTabOrder(anOkBtn, aCancelBtn);
+  QWidget* aLastControl = 0;
+  QList<QWidget*> aControls;
+  for (int i = myWidgets.size()-1; i >= 0 && !aLastControl; i--)  {
+    aControls = myWidgets[i]->getControls();
+    for (int j = aControls.size()-1; j >= 0 && !aLastControl; j--)  {
+      if (aControls[j]->focusPolicy() != Qt::NoFocus)
+        aLastControl = aControls[j];
     }
   }
+  if (aLastControl) {
+    QToolButton* anOkBtn = findChild<QToolButton*>(PROP_PANEL_OK);
+    QToolButton* aCancelBtn = findChild<QToolButton*>(PROP_PANEL_CANCEL);
+
+    setTabOrder(aLastControl, anOkBtn);
+    setTabOrder(anOkBtn, aCancelBtn);
+  }
 }
 
 const QList<ModuleBase_ModelWidget*>& XGUI_PropertyPanel::modelWidgets() const