forked from qt-creator/qt-creator
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:
@@ -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();
|
||||
|
@@ -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
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user