O'Reilly logo

Qt 5 Projects by Marco Piccolino

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding visual components to the element

Adding a visual representation for the element entity is achieved as follows:

// Element.qmlimport Qt3D.Core 2.9import Qt3D.Extras 2.9import Qt3D.Render 2.9Entity {    id: element    CuboidMesh {        id: cuboid    }    PhongMaterial {        id: phongMaterial    }    Transform {        id: transform    }    components: [cuboid, phongMaterial, transform]}

We added a CuboidMesh and a PhongMaterial, both provided by Qt3D.Extras (https://doc.qt.io/qt-5.9/qt3d-core-qmlmodule.html#qt-3d-extras-module), as well as a Transform, provided by Qt3D.Core (https://doc.qt.io/qt-5.9/qt3d-core-qmlmodule.html#qt-3d-core-module), so that we will be able to move the shape around later on. While we have defined these objects as children to Entity, this is not a ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required