Important: Please read the Qt Code of Conduct -

QML Chart does not respect width when using OpenGL 3.3 in macOS

  • Hi guys!

    I am building a simulator in which the GUI needs to update some charts (6) very fast (60 Hz). I am using QML Charts and it is painfully slow. After reading a lot, doing the data handling in C++, etc. I saw that I can improve the performance by using OpenGL.

    However, if I use this code:

    ChartView {
        title: "Line"
        anchors.fill: parent
        antialiasing: true
        LineSeries {
            name: "LineSeries"
            XYPoint { x: 0; y: 0 }
            XYPoint { x: 1.1; y: 2.1 }
            XYPoint { x: 1.9; y: 3.3 }
            XYPoint { x: 2.1; y: 2.1 }
            XYPoint { x: 2.9; y: 4.9 }
            XYPoint { x: 3.4; y: 3.0 }
            XYPoint { x: 4.1; y: 3.3 }

    with vanilla settings w.r.t. OpenGL, I get this as expected:


    However, if I change the OpenGL version to 3.3 (which I need to draw a 3D view) using this code:

        QSurfaceFormat glFormat;

    then I get this output:


    Notice that the line width is not respected anymore. Is there anything I can do to avoid this?

Log in to reply