diff options
Diffstat (limited to 'share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp')
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp index 9c81fdc970..0fbc28c6b5 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/camerageometry.cpp @@ -51,6 +51,19 @@ CameraGeometry::~CameraGeometry() { } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +QString CameraGeometry::name() const +{ + return objectName(); +} + +void CameraGeometry::setName(const QString &name) +{ + setObjectName(name); + emit nameChanged(); +} +#endif + QQuick3DCamera *CameraGeometry::camera() const { return m_camera; @@ -173,13 +186,16 @@ void CameraGeometry::fillVertexData(QByteArray &vertexData, QByteArray &indexDat QMatrix4x4 m; QSSGRenderCamera *camera = m_camera->cameraNode(); if (camera) { + QRectF rect = m_viewPortRect; + if (rect.isNull()) + rect = QRectF(0, 0, 1000, 1000); // Let's have some visualization for null viewports if (qobject_cast<QQuick3DOrthographicCamera *>(m_camera)) { // For some reason ortho cameras show double what projection suggests, // so give them doubled viewport to match visualization to actual camera view - camera->calculateGlobalVariables(QRectF(0, 0, m_viewPortRect.width() * 2.0, - m_viewPortRect.height() * 2.0)); + camera->calculateGlobalVariables(QRectF(0, 0, rect.width() * 2.0, + rect.height() * 2.0)); } else { - camera->calculateGlobalVariables(m_viewPortRect); + camera->calculateGlobalVariables(rect); } m = camera->projection.inverted(); } |