Skip to content

QVTKWidget fix for QT5

When reparenting a QVTKWidget with Qt5.x (on Windows), the application crashes, due to the lack of OpenGL resources of the Widget after reparenting. The current master (and older versions) contained code that finalizes the internal vtkRenderWindow before reparenting and starting it again after reparenting (by observing corresponding Qt events). However, directly after reparenting, the QWidget is not yet visible, so the vtkRenderWindow is not restored completely.

This merge request removes the Finalize() - and Start() - calls, with corresponding checks, since, to me, they do not seem necessary at all. Why, when setting a new parent, why should the vtkRenderWindow temporarily be "shut down"?

I have tested the patch on Windows and Linux, and both applications still run. Furthermore, it eventually made reparenting working with Qt5 (using the OpenGL2 backend). It also still works using OpenGL1 and Qt4 (which was working before and which did not make my application crash)

Merge request reports