Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QList and QPoints error: passing 'const QPointF' as 'this' argument of 'qreal& QPointF::rx()' discards qualifiers
-
Hello,
I have a QList with QPoints:
QList<QPointF> points;Why does this work:
qDebug()<<points.first().rx();and this not:?
qDebug()<<points.at(0).rx();thank you for you help!
-
Hi,
Because
at
returns a const reference whilefirst
can either return a reference or a const reference and rx is a non const method of QPointF.
-
I just want to add that you should not use non const methods when you can use const methods anyway.
qDebug()<<points.at(0).x();
-
super, thank you! that solved my litttle problem.