clenaup of the activeFocusItem fixed for Qt 5.15

This commit is contained in:
Uwe Rathmann 2021-03-11 17:32:59 +01:00
parent d1f2677c01
commit 76e61eba0d

View File

@ -732,8 +732,16 @@ void QskQuickItem::itemChange( QQuickItem::ItemChange change,
we might end up with having a dangling pointer for we might end up with having a dangling pointer for
oldWindow->activeFocusItem(). oldWindow->activeFocusItem().
*/ */
QQuickWindowPrivate::get( oldWindow )->clearFocusInScope(
qskNearestFocusScope( this ), this, Qt::OtherFocusReason ); auto wd = QQuickWindowPrivate::get( oldWindow );
if ( auto scope = qskNearestFocusScope( this ) )
{
wd->clearFocusInScope( scope, this, Qt::OtherFocusReason );
}
else
{
wd->activeFocusItem = nullptr;
}
} }
#endif #endif