Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to embed PyQtGraph in QML with a PySide2 Python Backend?



  • Due to license restrictions I do not want to use QTCharts, so I am looking at PyQtGraph library.

    I am working with PySide2 and QML. I am having difficulty getting a simple example working using QML because I don't know where to start. How do I embed one of these charts from the Python/Pyside2 backend to the QML front end?

    Do I need to use a QQuickWidget somehow? Anyone have any examples of how to do this?

    Can someone please point me in the right direction? Thank you



  • @Edwin-F.

    I asked on S.O. and got this answer, apparently this is not possible to put a Widget in QML. So I am going a different route to solve this issue.

    "pyqtgraph is based on QGraphicsView which is part of the Qt Widgets submodule, so what you are asking for is equivalent to asking that a Qt Widget be embedded in QML and that is not possible. QQuickWidget does the opposite, ie embed a QML in a Qt Widget. In conclusion you can not."


  • Lifetime Qt Champion

    Hi,

    You may have some luck with KDAB's Declarative Widgets module.



  • @SGaist

    Thanks Im looking into it


Log in to reply