Qt3D - Retrieving Qml Viewport Element as C++ Object
I've been messing around with Qt5 and Qt3D / Quick3D a bit but I getting stuck trying to retrieve my qml Viewport Element as a c++ Viewport object.
I can't seem to find the Viewport class include which is not indicated in the documentation :
I don't know if it's because it's deprecated or on the contrary not finalized yet.
Then I'd like to make sure I'm retrieving my object the right way so I've posted a sample of my code :
// SET STARTING QML FILE
//CONTROLLER BETWEEN QML VIEW AND MODELS
// GET ROOT QML OBJECT
this->rootQmlObject = this->viewer->rootObject();
// SET SCREESIZE IN ROOT OBJECT
// SHOW QML FILE IN FULLSCREEN
if ((tmpObj = this->rootQmlObject->findChild<QObject >("viewport")))
this->viewport = (Viewport)tmpObj;
std::cout << "ViewPort found" << std::endl;
if ((tmpObj = this->rootQmlObject->findChild<QObject >("root3dObject")))
this->root3dObject = (QQuickItem)tmpObj;
std::cout << "Root3dObject found" << std::endl;
Any help will be very appreciated.
For those interested, you can't really retrieve a Viewport directly from qml as it is a QQuickItem. So either you retrieve it as a QQuickItem* and then try to insert your 3D items in it (not tested but it should work) or you do this on the qml side using loaders.