1 year ago

#352126

test-img

LLLDaniel

qt3d, qml:Cannot assign to non-existent property "components"

In qt 5.15.2 version's Qt3D, I use the property name "components" occur error! is there anyone know? the modules I have imported to this file and .pro file sign the modules reference to the qt3d project, this all I can do as a new learner of qml. oh that's so obscure to learn qt3d.is that mean Scene3D type have no property name "components"? but the code is used by many project.

import QtQuick 2.9
import QtQuick.Controls 2.15
import QtQuick.Window 2.2


import Qt3D.Core 2.15
import Qt3D.Render 2.15
import Qt3D.Extras 2.15
import Qt3D.Logic 2.15
import Qt3D.Input 2.15
import Qt3D.Animation 2.15
import QtQuick.Scene3D 2.15

ApplicationWindow {
    id:root

    signal valchange(int val)

    visible: true
    width: 640
    height: 480
    title: qsTr("Scroll")

    Rectangle {
        anchors.fill: parent
        color: "darkred"
        Scene3D {
            id: scene3d
            anchors.fill: parent
            Camera {
                id: camera
                projectionType: CameraLens.PerspectiveProjection
                fieldOfView: 45
                aspectRatio: 16/9
                nearPlane: 0.1
                farPlane: 1000
                position: Qt.vector3d(200, 300, 300)
                upVector: Qt.vector3d(0, 1, 0)
                viewCenter: Qt.vector3d(0,0,0)
            }
            components: [
                RenderSettings {
                    activeFrameGraph: ForwardRenderer {
                        clearColor: Qt.rgba(0, 0.5, 1,1)
                        camera: camera
                    }
                },
                InputSettings {

                }

            ]
           PhongMaterial {
               id: material
           }
           TorusMesh {
               id: torusMesh
               radius: 5
               minorRadius: 1
               rings: 100
               slices: 20
           }

           Entity {
               id: torusEntity
               components: [torusMesh, material]
           }

        }
    }
}```

qml

qt3d

0 Answers

Your Answer

Accepted video resources