QAbstractListModel and QCustomPlot
-
@SGaist Yes, sorry - you are correct of course. I must admit that I had got more interested in the question about how well QCustomPlot works with QML in the first place. I guess I had assumed that there would be some way to define the plot from a model but you are correct that it is not obvious.
-
@Bob64 I am doing same work, but I think it is impossible. Because QcustomPlot depends on QWidgets and event loop, but the QML is other thing. In an app, they , event loop and QML, cann't run at same time. It is pity, but you can find other lib to achieve this function or you can try to recode QCustomPlot by QML which is meanful I think.
-
You should rather go with Qt Graphs. Qt Charts is also graphics view based although QML is also supported and is being deprecated.
-
@SGaist Hello SGaist,
in QtCharts I can use a model like this
ChartView { antialiasing: true anchors.fill: parent legend.visible: false LineSeries { VXYModelMapper { model: Hardcorechartmodelseries xColumn: 0 yColumn: 1 } } }
Is there also this opportunity in QtGraphs?
Tobias
-
The XYModelMapper is also there.
-
@SGaist I need also some help with QtGraphs: I changed all the "Charts" to "Graphs" in the cmake file and qml file, and in the QAbstractTableModel. The import QtGraphs prompt in QtCreator recognizes the package, but for this
GraphsView { antialiasing: true anchors.fill: parent legend.visible: false LineSeries { VXYModelMapper { model: Hardcorechartmodelseries xColumn: 0 yColumn: 1 } } }
I get a "unkown component" error in QtCreator for the prompts GraphsView, LineSeries and VXYModelMapper
I have no idea, what wents wrong. The former QtCharts even drawed some graphs.
-
Did you change your QML imports as well ?