Important: Please read the Qt Code of Conduct -

QAbstractitemmodel feeding Chartview

  • Hello, I see in Oscilloscope example that the update of Lineseries is done by sending the series pointer from qml to C++. So, no of line series is controlled by qml. But I am wondering if it is possible to create lineseries for the chartview depending upon the no of items in the QAbstractitemmodel.

  • Qt Champions 2017

    You can do it just like any other C++ class. Please note that LineSeries is not using the modelView framework. So you will not be able to use the QAbstractitemmodel like a model concept. You need to expose the properties from QAbstractitemmodel just like any other C++ object you expose to qml.

  • @dheerendra . Thanks for your reply. Okay I understand I cannot use model-view concept for charts. But depending upon the items which is Q_PROPERTY, can I generate same no. of series in charts?

  • Qt Champions 2017

    This can be done. Nothing stops you from using the Model object as normal C++ object. As best practice not very useful. If there is case where you are already using the model object, you can use here as well in your program.

Log in to reply