问题与 nearstPoint qwt 的语法

Probléme with syntax of closestPoint qwt

本文关键字:语法 qwt nearstPoint 问题      更新时间:2023-10-16

感谢您帮助我使用closestPoint qwt的方法恢复 y 对应于值 x 的值。我把它,但仍然是语法问题?

error: invalid type '<unresolved overloaded function types> [int]' for array subscript 

法典:

Curve-> closestPoint (pos [0], NULL); 

您收到此错误是因为您调用了某个方法,但您使用[]而不是()因此您应该使用:

Curve->closestPoint(pos(), NULL); 

正如医生所说closestPoint需要QPoint

int QwtPlotCurve::closestPoint (const QPoint & pos, double * dist = NULL ) const

例如:

Curve->closestPoint(QPoint(1,1),NULL);