pythonqmlvtkpyside6

PySide6 with QML and VTK9


I am trying to get a running example of a Qml application with PySide6 and an integrated VtkRenderWindow. I tried Qml-VTK-Python but there is a problem with the generated rs_qml.py from the pyside6-rcc when updating the packages to PySide6. And i dont want to mix the qt resource compiler. Fork of the project: Fork-Qml-VTK-Python. Or perhaps anybody has a small running example? Must not be based on links project, I just need Vtk9 and PySide2 qith qml. Best regards

What I did:

I updated the PySide2 packages to PySide6 in all files.

Changed the imports in fboRender.py

from PySide2.QtGui import (
    QCursor,
    QMouseEvent,
    QOpenGLFramebufferObject,
    QOpenGLFramebufferObjectFormat,
    QOpenGLFunctions,
    QWheelEvent,
)

to

from PySide6.QtGui import (
    QCursor,
    QMouseEvent,
    QOpenGLFunctions,
    QWheelEvent,
)
from PySide6.QtOpenGL import QOpenGLFramebufferObject, QOpenGLFramebufferObjectFormat

Changed in funcs.py

"pyside2-rcc.exe" to "rcc.exe" and also the any PySide2 to PySide6

i get than a Tracback error:

Traceback (most recent call last):
  File "C:\Projekte\scripts_python\qml-vtk-python\src\views\rc_qml.py", line 108
    QT_RCC_MANGLE_NAMESPACE0(name), QT_RCC_MANGLE_NAMESPACE0(QT_NAMESPACE))
                                                                          ^
SyntaxError: unmatched ')'
python-BaseException

Solution

  • I solved the problem with the qrc compiling error. I had to change
    pyside2-rcc.exe to pyside6-rcc.exe
    pyside2-rcc to pyside6-rcc
    I am pretty sure i tried it, but nevertheless it works now. Another options was removing the rcc-compiling and load the main.qml direct (which was the only file in the qrc).

    Rendering also works now (tested in linux) by replacing the OpenGLRenderWindow from gerneric to external.