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

Qt Quick QtCharts Module



  • HI,
    I am new to QtQuick and I Need help regarding importing Module Qtcharts I get an error that "QML module not found (QtCharts").
    I use python as Backend not C++
    is there anyone who faces such a problem and could found a solution?
    is there any way to import that module?
    Thanks, Inadvance!!```

    code_text
    ```import QtQuick 2.14
    import QtQuick.Window 2.14
    import QtCharts 2.14
    Window {
        width: 640
        height: 480
        visible: true
        title: qsTr("Hello World")
    }
    


  • @Mo_22 Are you using pyqt or pyside? What version is it? Show the .py



  • In pro file:

    QT += quick charts
    

    In qml file:

    import QtCharts 2.3
    

    Highest available version in 5.15, might be lower in 5.14



  • @eyllanesc said in Qt Quick QtCharts Module:

    pyqt
    Hi,
    thank you for helping me.
    python code
    import os
    import sys

    from PyQt5 import QtCore, QtGui, QtWidgets
    from PyQt5.QtCore import QUrl, QObject, pyqtSignal, pyqtSlot
    from PyQt5.QtWidgets import QApplication
    from PyQt5.QtQml import QQmlApplicationEngine
    from PyQt5.QtQuick import QQuickImageProvider
    app = QApplication(sys.argv)

    engine = QQmlApplicationEngine()
    engine.quit.connect(app.quit)
    engine.load('main.qml')

    sys.exit(app.exec())

    and QMl Code
    mport QtQuick 2.14
    import QtQuick.Layouts 1.14
    import QtQuick.Controls 2.14
    import QtQuick.Controls.Material 2.14
    import QtQuick.Controls.Universal 2.14
    import QtCharts 2.14
    ApplicationWindow {
    id:main_window
    visible: true
    minimumHeight: 750
    minimumWidth: 1200
    ChartView {
    width: 400
    height: 300
    theme: ChartView.ChartThemeBrownSand
    antialiasing: true

        PieSeries {
            id: pieSeries
            PieSlice { label: "eaten"; value: 94.9 }
            PieSlice { label: "not yet eaten"; value: 5.1 }
        }
    }
    

    }



  • @Mo_22 What version of PyQt5 do you use? Have you installed pyqtchart? python -m pip install pyqtchart



  • @fcarney

    Hi,
    I am using python as Backend, not C++ so I don't have a pro file Should I add a pro file if I use Pyqt and Qml?
    Thank you![alt text](Qtcreatorpythonchartview.PNG Qtcreatorinstalllibs.PNG image url)



  • @Mo_22 It is not necessary to create a .pro. On the other hand, do not confuse Qt with Qt for Python. Qt installations do not influence PyQt



  • @eyllanesc
    hi,
    Thanks a lot for your help I did check my pyqtchart version I found it 5.15.2.
    when I change the import statement in the qml file to (import QtCharts 2.15) the program work.
    yes, I thought there are no effects of the version of the PyQtChart on what I import in the QML
    the last Question.
    when I use import in the Qml file how is it works?
    is it import from the Qt installations

    qmlchartfinalimport.PNG image URL)



  • @Mo_22 That is a QtCreator bug, forget it.


Log in to reply