QCustomPlot Discussion and Comments

Plot data in tablemodelReturn to overview

Providing i had put data in QCPGraph, how can I obtain the x and y values in table model? That is:

QVariant MyTableModel::data(const QModelIndex &index, int role) const
{
	if (role == Qt::DisplayRole)
	{
		//how can I access the values if i can access index.column() and index.row()?
	}
	return QVariant();
}

here you go:

if (role == Qt::DisplayRole)
{
    if(index.column()==0)
    { return (graph->data()->begin()+index.row()).key();}
    else
    {
         QCPData b = (graph->data()->begin()+index.row()).value();
         return b.value;
     }
}