From: nds Date: Wed, 14 Oct 2015 12:30:14 +0000 (+0300) Subject: Apply button accepts the focus after last control in the Property panel. Controls... X-Git-Tag: V_2.0.0_alfa1~93 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;ds=sidebyside;h=7bac0ce308b594cf5e682c1153c59ef3507b794c;p=modules%2Fshaper.git Apply button accepts the focus after last control in the Property panel. Controls with empty focus policy are ignored. --- diff --git a/src/PartSet/PartSet_WidgetPoint2DFlyout.h b/src/PartSet/PartSet_WidgetPoint2DFlyout.h index 3c294d3b5..cbcdc473f 100755 --- a/src/PartSet/PartSet_WidgetPoint2DFlyout.h +++ b/src/PartSet/PartSet_WidgetPoint2DFlyout.h @@ -8,7 +8,7 @@ #define PartSet_WidgetPoint2DFlyout_H #include "PartSet.h" -#include +#include class XGUI_Workshop; diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index 637521cb7..3838f7886 100644 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -119,19 +119,23 @@ void XGUI_PropertyPanel::setModelWidgets(const QList& t connect(aWidget, SIGNAL(keyReleased(QKeyEvent*)), this, SIGNAL(keyReleased(QKeyEvent*))); } - ModuleBase_ModelWidget* aLastWidget = theWidgets.last(); - if (aLastWidget) { - QList aControls = aLastWidget->getControls(); - if (!aControls.empty()) { - QWidget* aLastControl = aControls.last(); - QToolButton* anOkBtn = findChild(PROP_PANEL_OK); - QToolButton* aCancelBtn = findChild(PROP_PANEL_CANCEL); - - setTabOrder(aLastControl, anOkBtn); - setTabOrder(anOkBtn, aCancelBtn); + QWidget* aLastControl = 0; + QList 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(PROP_PANEL_OK); + QToolButton* aCancelBtn = findChild(PROP_PANEL_CANCEL); + + setTabOrder(aLastControl, anOkBtn); + setTabOrder(anOkBtn, aCancelBtn); + } } const QList& XGUI_PropertyPanel::modelWidgets() const