Search code examples
c++qtpointersqlist

How to display QPointF stored in a QList?


QList <QPointF> markers;
markers.append (QPointF (getLat (), getLon ()));


QList <QPointF> :: iterator i;
for (i = markers.begin(); i != markers.end(); ++i)
     std :: cout << *i << endl;

Gives me:

error: no match for 'operator<<' in 'std::cout << i.QList::iterator::operator* with T = QPointF'


Solution

  • You can use qDebug().

    QList<QPointF> markers;
    markers.append(getLat(), getLon());
    QList<QPointF>::iterator i;
    for (i = markers.begin(); i != markers.end(); ++i)
        qDebug() << *i;
    

    Remember to include QDebug:

    #include <QDebug>