Using modules

Before using each of the Qt 3D modules, you have to enable the module separately in the project file. For example, the following line will enable all currently documented modules:

QT += 3dcore 3drender 3dinput 3dlogic 3danimation \      qml quick 3dquick 3dquickextras 3dquickscene2d

When using QML, each module must also be separately imported:

import Qt3D.Core 2.10import Qt3D.Render 2.10import Qt3D.Extras 2.10import Qt3D.Input 2.0import Qt3D.Logic 2.0import QtQuick.Scene2D 2.9import QtQuick.Scene3D 2.0
You can see that different Qt 3D modules have different QML module versions. Some modules were updated in Qt 5.10 and have new features that we'd like to use in our code, so you have to specify the last version (2.10) to make new QML ...

Get Game Programming using Qt 5 Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.