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

The Element entity

The Element entity represents a 3D object that we place within a composition. In our business domain (comics creation), it could stand for a character, a prop, a speech bubble, and so on. In order for the entity to show up within the composition, we should give it at least a mesh (3D shape), a material, and a position. Furthermore, we should make it also selectable so that we can move it around or remove it. Let's implement each of these capabilities with Qt 3D.

We start by creating an Element QML file in gui and defining its root type as a Qt 3D entity:

// Element.qmlimport Qt3D.Core 2.9Entity {    id: element}

Running the example in Preview3D won't yield any results, as the entity has no visual components attached to it ...

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