since Qt 5.12 topLevel children are removed in ~QQuickWindow and we

don't need to do this in ~QskWindow anymore
This commit is contained in:
Uwe Rathmann 2020-05-10 11:16:39 +02:00
parent ecf49658f7
commit 3919fc4938

View File

@ -195,28 +195,25 @@ QskWindow::QskWindow( QWindow* parent )
QskWindow::QskWindow( QQuickRenderControl* renderControl, QWindow* parent )
: QskWindow( parent )
{
auto* d = static_cast< QskWindowPrivate* >( QQuickWindowPrivate::get( this ) );
Q_D( QskWindow );
d->renderControl = renderControl;
d->init( this, renderControl );
}
QskWindow::~QskWindow()
{
#if QT_VERSION < QT_VERSION_CHECK( 5, 12, 0 )
// When being used from Qml the item destruction would run in the most
// unefficient way, leading to lots of QQuickItem::ItemChildRemovedChange
// depending operations. So let's remove the toplevel children manually.
// depending operations.
QVector< QPointer< QQuickItem > > items;
Q_D( QskWindow );
const auto children = contentItem()->childItems();
for ( auto child : children )
{
if ( child->parent() == contentItem() )
items += child;
}
for ( auto& item : qskAsConst( items ) )
delete item;
auto contentItem = d->contentItem;
d->contentItem = nullptr;
delete contentItem;
#endif
}
void QskWindow::setScreen( const QString& name )