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::QskWindow( QQuickRenderControl* renderControl, QWindow* parent )
: QskWindow( parent ) : QskWindow( parent )
{ {
auto* d = static_cast< QskWindowPrivate* >( QQuickWindowPrivate::get( this ) ); Q_D( QskWindow );
d->renderControl = renderControl; d->renderControl = renderControl;
d->init( this, renderControl ); d->init( this, renderControl );
} }
QskWindow::~QskWindow() QskWindow::~QskWindow()
{ {
#if QT_VERSION < QT_VERSION_CHECK( 5, 12, 0 )
// When being used from Qml the item destruction would run in the most // When being used from Qml the item destruction would run in the most
// unefficient way, leading to lots of QQuickItem::ItemChildRemovedChange // 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(); auto contentItem = d->contentItem;
for ( auto child : children ) d->contentItem = nullptr;
{ delete contentItem;
if ( child->parent() == contentItem() ) #endif
items += child;
}
for ( auto& item : qskAsConst( items ) )
delete item;
} }
void QskWindow::setScreen( const QString& name ) void QskWindow::setScreen( const QString& name )