clearing the focus flag, when removing an item from the window

This commit is contained in:
Uwe Rathmann 2020-03-06 10:51:14 +01:00
parent b4077ebe4d
commit e75937f711

View File

@ -690,6 +690,27 @@ void QskQuickItem::itemChange( QQuickItem::ItemChange change,
}
#endif
#if 1
if ( value.window == nullptr )
{
Q_D( QskQuickItem );
if( d->focus )
{
/*
The focus flag is not cleared, when removing an
item from the window. In situations where the item gets
reinserted into the window - or transferred to another one -
we might run into situations, where 2 items in the same scope
have the "focus" flag being set.
A better solution might be to check the flag when reinserting
into a window ...
*/
d->focus = false;
}
}
#endif
QskWindowChangeEvent event( oldWindow, value.window );
QCoreApplication::sendEvent( this, &event );