focus tab chain update fixed, when re-inserting am item at the end, that had already been
inserted before
This commit is contained in:
parent
c88ae44687
commit
fc63f316b4
@ -17,4 +17,5 @@ TestRectangle::TestRectangle( const char* colorName, QQuickItem* parent ):
|
||||
|
||||
setPreferredSize( 10, 10 );
|
||||
setSizePolicy( QskSizePolicy::Minimum, QskSizePolicy::Minimum );
|
||||
setFocusPolicy( Qt::TabFocus ); // for checking the focus tab chain
|
||||
}
|
||||
|
@ -104,17 +104,33 @@ void QskLayout::insertItemInternal( QskLayoutItem* layoutItem, int index )
|
||||
if ( item->parentItem() != this )
|
||||
item->setParentItem( this );
|
||||
|
||||
if ( index >= 0 )
|
||||
{
|
||||
// to have a proper focus tab chain
|
||||
/*
|
||||
Re-ordering the child items to have a a proper focus tab chain
|
||||
*/
|
||||
|
||||
bool reordered = false;
|
||||
|
||||
if ( ( index >= 0 ) && ( index < itemCount() - 1 ) )
|
||||
{
|
||||
for ( int i = index; i < engine.itemCount(); i++ )
|
||||
{
|
||||
QskLayoutItem* layoutItem = engine.layoutItemAt( index );
|
||||
auto layoutItem = engine.layoutItemAt( i );
|
||||
if ( layoutItem && layoutItem->item() )
|
||||
{
|
||||
item->stackBefore( layoutItem->item() );
|
||||
reordered = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !reordered )
|
||||
{
|
||||
const auto children = childItems();
|
||||
if ( item != children.last() )
|
||||
item->stackAfter( children.last() );
|
||||
}
|
||||
}
|
||||
|
||||
engine.insertLayoutItem( layoutItem, index );
|
||||
|
Loading…
x
Reference in New Issue
Block a user