diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 2c040b2d635..23588d4917c 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -2177,7 +2177,12 @@ void QTreeView::doItemsLayout() } QAbstractItemView::doItemsLayout(); d->header->doItemsLayout(); - d->updateAccessibility(); + // reset the accessibility representation of the view once control has + // returned to the event loop. This avoids that we destroy UI tree elements + // in the platform layer as part of a model-reset notification, while those + // elements respond to a query (i.e. of rect, which results in a call to + // doItemsLayout(). + QMetaObject::invokeMethod(this, [d]{ d->updateAccessibility(); }, Qt::QueuedConnection); } /*!