c++ - How to plot QAbstractItemModel using QCustomPlot -


is there direct way pass qabstractitemmodel qcustomplot? defining 2 qvector<double> xval , yval. when have plot, update these 2 vectors qabstractitemmodel launch plot function.

is there way qcustomplot can accept qabstractitemmodel?

afaik there not direct support qabstractitemmodel in qcustomplot. not sure how expect qcustomplot draw contents of qabstractitemmodel. know model simple model or complex 1 or hierarchical. that's 2 simple 2d plot qcustomplot. there seems way assign data of subclass of qabstractitemmodel qcustomplot , that's using qcpdatamap.

you should populate data of model in qcpdatamap , assign plot. that's :

qcpdatamap *data = new qcpdatamap();  for(int i=0; i<count; i++)     data->insertmulti(data->constend(), x[i], qcpdata(x[i], y[i]));  plot->graph()->setdata(data); 

you can generate qcpdatamap in model using x , y values , assign it's pointer plot.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

c# - Retrieve google contact -

javascript - How to insert selected radio button value into table cell -