qtquick: Fix assert that assumed the content item only had 1 child

QQuickWindow has other things like popup overlays parented to
the content item too.
This commit is contained in:
Sergio Martins
2022-05-30 19:14:22 +01:00
parent c619c72094
commit 4d1add5221

View File

@@ -26,7 +26,9 @@ std::shared_ptr<ViewWrapper> Window_qtquick::rootView() const
{
if (auto quickwindow = qobject_cast<QQuickWindow *>(m_window)) {
auto contentItem = quickwindow->contentItem();
Q_ASSERT(contentItem->childItems().size() == 1);
const auto children = contentItem->childItems();
Q_ASSERT(!children.isEmpty());
return Views::asQQuickWrapper(contentItem->childItems().first());
} else {
qWarning() << Q_FUNC_INFO << "Expected QQuickView";