@LeLev
In the main.qml file I have navigation elements (e.g. Drawer) and other UI elements (e.g. tabs, splitter etc.) and inside the main.qml I need to display MyRect.qml (it holds the VtkFboItem).
I also need to connect the VtkFboItem with the C++ object to display AND interact with 3D graphics.
ApplicationWindow {
id: root
Rectangle {
id: screenCanvasUI
anchors.fill: parent
Drawer{
……..
}
MyRect{ }
}
Button {
id: openFileButton
text: "Add Model"
…………...
}
FileDialog {.....}
}//end:ApplicationWindow
/MyRect.qml file:
Item{
VtkFboItem {
objectName: "vtkFboItem"
anchors.fill: parent
MouseArea {
.............
}
}//end: VtkFBO
}//end: Item
//main.cpp file
.......
// Load main QML file
engine.load(QUrl("qrc:/resources/main.qml"));
// Get reference to the QVTKFramebufferObjectItem created in QML
QObject* rootObject = engine.rootObjects()[0];
m_vtkFboItem = rootObject->findChild<QVTKFramebufferObjectItem*>("vtkFboItem");
QObject* rootObject = engine.rootObjects()[0];
m_vtkFboItem = rootObject->findChild<QVTKFramebufferObjectItem*>("vtkFboItem");
if (m_vtkFboItem)
{
m_vtkFboItem->setProcessingEngine(m_processingEngine);
connect(m_vtkFboItem, &QVTKFramebufferObjectItem::rendererInitialized, this, &CanvasHandler::startApplication);
.....................
}
app.exec();
In the above scenario, how should I be able to find and connect to the vtkFboItem from the main.cpp?
Is there any other way to achieve this apart from the objectName?
I have attached here a screenshot of the final UI that I am trying to achieve.[image: 18b7b2b6-55d7-41b3-ae0a-fb399fe27e30.PNG]