QCustomPlot Discussion and Comments

Browse iteratorReturn to overview

I haven't used to use iterators so i'm frustrated with simple things.

I have graph with keys and values and i would like browse the content something like this:

QCPDataContainer<QCPGraphData> *data = t->data().data();

    foreach (QVector<QCPGraphData> i, data->begin()) {
        qDebug() << i;
        //ts << d.key << ";" << d.value;
        //endl(ts);
    }

But inside the foreach is not correct.

I try :
foreach (QCPGraphData *i, data->begin()) {
That for me is the correct way but it's not working.

And I don't know th QSharedPointer used in library.

Someone have an idea ?

I found myself the solution I think...

I have the correct result with this :

QCPDataContainer<QCPGraphData> *data = t->data().data();
QCPDataContainer<QCPGraphData>::iterator it = data->begin();

QTime time;
while(it != data->end())
{
    qDebug() << it->key << it->value;
    it++;
}