QmlDesigner: Fix camera frustum initialization for Qt5 builds

In Qt5 builds, we need additional async update at camera geometry
initialization to ensure source camera is up to date and frustum mesh
can be constructed.

Fixes: QDS-6071
Change-Id: I41371ae66fde432b0fdf4b5fee6a0604d005bf63
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Miikka Heikkinen
2022-01-25 15:31:32 +02:00
parent 35d32c9784
commit 557489c3fc
2 changed files with 13 additions and 0 deletions

View File

@@ -142,6 +142,16 @@ void CameraGeometry::doUpdateGeometry()
if (!QQuick3DObjectPrivate::get(m_camera)->spatialNode) {
// Doing explicit viewport mapping forces cameraNode creation
m_camera->mapToViewport({}, m_viewPortRect.width(), m_viewPortRect.height());
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if (!m_nodeCreationUpdateDone) {
// Post-node creation update is done only once to avoid infinite loop in case the node
// creation fails.
m_nodeCreationUpdateDone = true;
m_cameraUpdatePending = true;
update();
return;
}
#endif
}
GeometryBase::doUpdateGeometry();

View File

@@ -67,6 +67,9 @@ private:
QQuick3DCamera *m_camera = nullptr;
QRectF m_viewPortRect;
bool m_cameraUpdatePending = false;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
bool m_nodeCreationUpdateDone = false;
#endif
};
}