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 );
|
setPreferredSize( 10, 10 );
|
||||||
setSizePolicy( QskSizePolicy::Minimum, QskSizePolicy::Minimum );
|
setSizePolicy( QskSizePolicy::Minimum, QskSizePolicy::Minimum );
|
||||||
|
setFocusPolicy( Qt::TabFocus ); // for checking the focus tab chain
|
||||||
}
|
}
|
||||||
|
@ -104,19 +104,35 @@ void QskLayout::insertItemInternal( QskLayoutItem* layoutItem, int index )
|
|||||||
if ( item->parentItem() != this )
|
if ( item->parentItem() != this )
|
||||||
item->setParentItem( this );
|
item->setParentItem( this );
|
||||||
|
|
||||||
if ( index >= 0 )
|
/*
|
||||||
{
|
Re-ordering the child items to have a a proper focus tab chain
|
||||||
// to have a proper focus tab chain
|
*/
|
||||||
|
|
||||||
|
bool reordered = false;
|
||||||
|
|
||||||
|
if ( ( index >= 0 ) && ( index < itemCount() - 1 ) )
|
||||||
|
{
|
||||||
for ( int i = index; i < engine.itemCount(); i++ )
|
for ( int i = index; i < engine.itemCount(); i++ )
|
||||||
{
|
{
|
||||||
QskLayoutItem* layoutItem = engine.layoutItemAt( index );
|
auto layoutItem = engine.layoutItemAt( i );
|
||||||
if ( layoutItem && layoutItem->item() )
|
if ( layoutItem && layoutItem->item() )
|
||||||
|
{
|
||||||
item->stackBefore( 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 );
|
engine.insertLayoutItem( layoutItem, index );
|
||||||
|
|
||||||
if ( m_data->isActive )
|
if ( m_data->isActive )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user