[Interest] Build a Qt3D scene in C++ and use it in a QtQuick one

dns.botond at gmail.com dns.botond at gmail.com
Thu Sep 6 20:36:13 CEST 2018


Hi,

According to the documentation [1] there are two ways to use Qt3D:
* From C++.
* From QML.

There is also a bridge class (Qt3DScene2D) which allows rendering a
QtQuick2 content into a Qt3D scene and another one (QtQuick.Scene3D)
which allows for the opposite, rendering a Qt3D scene into a QtQuick
one, however this latter only allows working with the Qt3D QML types. 
What I would like to do is to generate the scene from C++ and use it in
a QtQuick2 GUI. Kinda like how inheriting from QQuickItem allows one to
do the drawing in C++ and seamlessly integrate the resulting item into
a QML scene.
Looking at the sources [2] this should be easily achievable, all we'd
need is a slightly modified `Scene3DItem` class which allows the
inheriting class to set up the entity tree and other aspects of the
scene and not allowing these to be meddled with from QML (basically
stripping all existing properties and invokables and requiring them to
be set by C++ code).

Are there any plans to allow for something like this? Or is there
already a way to do this that I'm not aware of?

Regards,
Botond

[1] https://doc.qt.io/qt-5/qt3d-index.html
[2] 
https://code.qt.io/cgit/qt/qt3d.git/tree/src/quick3d/imports/scene3d




More information about the Interest mailing list