0

I'm following* this example: http://doc.qt.io/qt-5/qt3drenderer-multiviewport-example.html

*Adding it line-by-line to fresh project, looking up what each thing is as I go.

However, the CameraLens QML component isn't being found. I'm using QT Creator 3.6.0.

Here's the .pro:

TEMPLATE = app

QT += 3dcore 3drenderer 3dquick qml quick
CONFIG += c++11

SOURCES += main.cpp

RESOURCES += qml.qrc

# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =

# Default rules for deployment.
include(deployment.pri)

Here's my QML:

import QtQuick 2.0
import Qt3D 2.0
import Qt3D.Renderer 2.0

Entity {
    id: rootNode

    CameraLens {
        id: cameraLens
        projectionType: CameraLens.PerspectiveProjection
        fieldOfView: 45
        aspectRatio: 16/9
        nearPlane: 0.01
        farPlane: 1000.0
    }
}

As far as I'm able to tell, I'm on QT 5.5 (it's the only one I've got installed), which this documentation says should include the CameraLens: http://doc.qt.io/qt-5/qml-qt3d-cameralens.html

I don't know what to look at next or what might be going wrong.

Narfanator
  • 5,595
  • 3
  • 39
  • 71
  • I'm able to run the multiviewport example – but it doesn't show up in the "Examples" section – had to go to the "Examples -> qt3d" directory and load/build "qt3d.pro". I don't see any "CameraLens.qml" file or see in the c++ code where it is defined. The Qt example code is a bit hard to navigate since there are so many shared elements, etc. – spring Jan 26 '16 at 22:45
  • http://doc.qt.io/qt-5/qt3drenderer-multiviewport-main-qml.html – Narfanator Jan 26 '16 at 23:04

1 Answers1

0

It is defined in qt3dquick3dcoreplugin.cpp:

qmlRegisterType<Qt3D::QCameraLens>(uri, 2, 0, "CameraLens");

ChrisF
  • 134,786
  • 31
  • 255
  • 325
spring
  • 18,009
  • 15
  • 80
  • 160