From 19c0e43e5cb2d9fb821f344ffd06bbaccaa582f4 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Fri, 19 Jan 2018 10:08:59 +0100 Subject: [PATCH] find a default focus item, when a focusScope/tabFence control ( usually a popup ) gets the focus - to be on the internal tab chain. --- src/controls/QskControl.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/controls/QskControl.cpp b/src/controls/QskControl.cpp index ab2ae90c..1c65a02c 100644 --- a/src/controls/QskControl.cpp +++ b/src/controls/QskControl.cpp @@ -1049,6 +1049,23 @@ bool QskControl::event( QEvent* event ) break; } + case QEvent::FocusIn: + { + if ( isFocusScope() && isTabFence() && ( scopedFocusItem() == nullptr ) ) + { + /* + When receiving the focus we need to have a focused + item, so that the tab focus chain has a starting point. + */ + + if ( auto focusItem = nextItemInFocusChain( true ) ) + { + if ( qskIsAncestorOf( this, focusItem ) ) + focusItem->setFocus( true ); + } + } + break; + } } switch( eventType )