From 33fd24909f846d17557ec18aebdc6ac4d34f45f8 Mon Sep 17 00:00:00 2001 From: nds Date: Sat, 26 Dec 2015 19:54:01 +0300 Subject: [PATCH] #1189 Tab - Cancel - Enter validate not cancel: In case of disabled Apply button, set focus to the Cancel --- src/XGUI/XGUI_PropertyPanel.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index 2902755d4..e298bd030 100755 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -247,9 +247,6 @@ void findDirectChildren(QWidget* theParent, QList& theWidgets, const b bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext) { - //bool isChangedFocus = ModuleBase_IPropertyPanel::focusNextPrevChild(theIsNext); - //return true;//isChangedFocus; - // it wraps the Tabs clicking to follow in the chain: // controls, last control, Apply, Cancel, first control, controls bool isChangedFocus = false; @@ -273,7 +270,13 @@ bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext) if (aFocusWidgetIndex == aChildrenCount-1) { // after the last widget focus should be set to "Apply" QToolButton* anOkBtn = findChild(PROP_PANEL_OK); - aNewFocusWidget = anOkBtn; + if (anOkBtn->isEnabled()) + aNewFocusWidget = anOkBtn; + else { + QToolButton* aCancelBtn = findChild(PROP_PANEL_CANCEL); + if (aCancelBtn->isEnabled()) + aNewFocusWidget = aCancelBtn; + } } else { aNewFocusWidget = aChildren[aFocusWidgetIndex+1]; -- 2.39.2