diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2016-06-10 11:27:15 +0200 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2016-06-11 21:08:47 +0000 |
commit | 128823a7a183d4bdd22840ae9d0ee6ab16584ad3 (patch) | |
tree | b28362c58237bd08d88a2ef64b2698e7d40edab1 /src/quick3d/quick3dextras | |
parent | 71b117154b12a52d25369b29ebababc841d80bca (diff) |
Qt3DQuickWindow: set proper aspect ratio on creation
+ proper code indentation
Change-Id: Ib0f28aecfdb55c4012e23835a0440e5ae3a4c00e
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/quick3d/quick3dextras')
-rw-r--r-- | src/quick3d/quick3dextras/qt3dquickwindow.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/quick3d/quick3dextras/qt3dquickwindow.cpp b/src/quick3d/quick3dextras/qt3dquickwindow.cpp index 7d4ad0dd9..30348de09 100644 --- a/src/quick3d/quick3dextras/qt3dquickwindow.cpp +++ b/src/quick3d/quick3dextras/qt3dquickwindow.cpp @@ -179,7 +179,7 @@ void Qt3DQuickWindow::onSceneCreated(QObject *rootObject) if (m_cameraAspectRatioMode == AutomaticAspectRatio) { // Set aspect ratio of first camera to match the window QList<Qt3DRender::QCamera *> cameras - = rootObject->findChildren<Qt3DRender::QCamera *>(); + = rootObject->findChildren<Qt3DRender::QCamera *>(); if (cameras.isEmpty()) { qWarning() << "No camera found"; } else { @@ -202,7 +202,7 @@ void Qt3DQuickWindow::setWindowSurface(QObject *rootObject) // Find surface selector in framegraph and set ourselves up as the // render surface there Qt3DRender::QRenderSettings *rendererSettings - = rootObject->findChild<Qt3DRender::QRenderSettings *>(); + = rootObject->findChild<Qt3DRender::QRenderSettings *>(); if (!rendererSettings) { qWarning() << "No renderer settings component found"; return; @@ -231,6 +231,8 @@ void Qt3DQuickWindow::setCameraAspectModeHelper() case AutomaticAspectRatio: connect(this, &QWindow::widthChanged, this, &Qt3DQuickWindow::updateCameraAspectRatio); connect(this, &QWindow::heightChanged, this, &Qt3DQuickWindow::updateCameraAspectRatio); + // Update the aspect ratio the first time the surface is set + updateCameraAspectRatio(); break; case UserAspectRatio: disconnect(this, &QWindow::widthChanged, this, &Qt3DQuickWindow::updateCameraAspectRatio); |