Hi, I've got a problem using qSort, when I reimplement LessThan :
In my Vertical class:
And the compiler says that qsort does not look as a function that takes 2 arguments, and gives me some lines number erros in qalgorithms.hCode:
QList<Plane *> Vertical::planes; //static list of Plane objects bool lessThan( const Plane *plane1, const Plane *plane2) { Plane *me = Vertical::getPlanes().at(0); return(plane1->close(me->getPosition()) < plane2->close(me->getPosition())); } { QList <Plane *> list; qCopy(planes.begin()+1, planes.end(), list.begin()); qSort(list.begin(), list.end(),lessThan); ....... } QList<Plane *> Vertical::getPlanes() { return planes; } and in the Plane class : { return (sqrt((double)((p.x()-position.x())^2 + (p.y()-position.y())^2))); }
Any ideas ???