Qt3D - Retrieving Qml Viewport Element as C++ Object
Hey guys,
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 :
http://qt-project.org/doc/qt-5.0/qml-viewport.html
http://doc-snapshot.qt-project.org/5.0/viewport.html
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 :
- bool QmlViewManager::initView()
- {
- // SET STARTING QML FILE
- this->viewer->show();
- //CONTROLLER BETWEEN QML VIEW AND MODELS
- this->viewer->rootContext()->setContextProperty("controller", this);
- // GET ROOT QML OBJECT
- this->rootQmlObject = this->viewer->rootObject();
- // SET SCREESIZE IN ROOT OBJECT
- this->rootQmlObject->setProperty("width", this->desktopWidget->screenGeometry(-1).width());
- this->rootQmlObject->setProperty("height", this->desktopWidget->screenGeometry(-1).height());
- // SHOW QML FILE IN FULLSCREEN
- {
- this->viewport = (Viewport*)tmpObj;
- std::cout << "ViewPort found" << std::endl;
- }
- {
- this->root3dObject = (QQuickItem*)tmpObj;
- std::cout << "Root3dObject found" << std::endl;
- }
- }
Any help will be very appreciated.
Thanks
1 reply
You must log in to post a reply. Not a member yet? Register here!
