Hi, I’m new to the forum. I’m currently working on a project with Qt 5.12 and VTK 9.1 in which I want to use a custom interactorStyle. In my qml I have
VTKRenderWindow {
id: vtkwindow
width: 400
height: 400
}
ModelViewer {
objectName: "ModelViewer"
anchors.fill: vtkwindow
renderWindow: vtkwindow
}
ModelViewer
is my custom class which inherits from QQuickVTKRenderItem
. From within ModelViewer
I try to change the interactorStyle like this:
vtkNew<vtkInteractorStyleFlight> style;
renderWindow()->renderWindow()->GetInteractor()->SetInteractorStyle(style);
When I move within the scene I get an error message after a short time
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QVTKInteractorInternal(0x55f0a93f3e20), parent's thread is QThread(0x55f0a90e7ce0), current thread is QSGRenderThread(0x55f0a97e3d50)
then the program segfaults. I also printed out the current thread when I set the new style and it is not QSGRenderThread
. Setting QSG_RENDER_LOOP=basic
makes the application run without any errors.
Unfortunately I could not find any examples on how to change the interactor in a Qt setting so thank you in advance for any help.