QML Rendering Problem

Hi,
I use QT Qml as GUI framework and use VTK for 3D rendering. I tried QQuickVTKRenderWindow which is functional. However, I read the source code and it says ‘All the QtQuick element rendering is stacked visually above the vtk rendering’. This is extremely inconvenient to stack ui elements. I would like to ask if is there any schedule to fix this bug.
Or it’s actually not a bug but some nasty rendering pipeline issue between QML and VTK.
I checked QML documentation and it says QQuickFramebufferObject class is a convenience class for integrating OpenGL rendering using a framebuffer object (FBO) with Qt Quick. Is there any reason not using this class for VTK integration? Did you encounter some issue following QQuickFramebufferObject path?
Thanks, it would really helps a lot. I love VTK but I also want to use qml.

2 Likes

@lgivord @sankhesh

Your analysis is correct, QtQuick support is very new and will be improved over time.

1 Like

thanks for the awesome information.

There will also be conflicts between the Vtk render thread, the gui Main thread and the QML rendering thread which need to be managed by you, the developer. One must be extremely careful about managing these threads or you will be artifacts and crashes in your application.

Thanks. We are trying to manage that. We found a project in github which works in vtk8 but not in vtk9.

The project works fine with vtk8 in rendering but has some flaw in GPU volume rendering and interaction. So now we are usingVTK8.2 + QT5.15, and we use vtk9 as a programming reference for interaction.
Currently it seems to work fine, but we haven’t test it much.
Hope it helps.

Thanks for the note. And apart from being careful, we have changed to a complete MVC framework, so that if qml+vtk fails, we can change it to qwidget+vtk.

We basically called a deferred rendering through a lambda that allows QML its time to do rendering, then hands over control to VTK for its rendering. It is a bit convoluted but is very stable in the end. If I had to do things over I never would have selected QML. I would absolutely stuck with QWidgets for a desktop application. 5.15 is missing stuff and 6.2 just isn’t ready for desktop. If you stick with QML there is a long road ahead of you for development. Just my 2 cents.

You can see my discourse
All Animation in widget not work when use vtk with Qml

and this
Vtk9.1 for Qml with QQuickvtkrenderItem have some issues.

Hi, do we have any plan to fix this problem? IWill the fix happen in the next release ? We really need VTK view to display above Quick elements. Thanks~

From https://discourse.paraview.org/t/how-are-features-and-bug-fixes-incorporated-into-paraview/4735

As with all open source projects, adding features and fixing bugs takes developer effort. That effort may originate from volunteer community contributors, or through paid professional services offered by companies like Kitware . Features and bug fixes are prioritized by the needs of contributing community members and by professional services customers.

You can try the QQuickVTKItem[.cpp/.h] from here: GitHub - john-stone-ics/QuickVtk: rewrite of https://github.com/qCring/QuickVtk

It works much better.

Thanks so much ! :+1: :+1: :+1:

Here is most up to date version:

Pull Request
https://gitlab.kitware.com/vtk/vtk/-/merge_requests/9763