I want to define functions which will delete self-defined type object and the index from the QVector. Originally the source was as follows:
    Point PointCollection::RemovePoint(int index)
{
    Point removedPoint = new Point(this[index].Id, this[index].X, this[index].Y);
    this->remove(index);
    updateCentroid();
    return (removedPoint);
}
Point PointCollection::RemovePoint(Point p)
{
    Point removedPoint = new Point(p.GetId(), p.GetX(), p.GetY());
    this.remove(p);
    updateCentroid();
    return (removedPoint);
}
which was not working as I think because of new. Then I modified the source to the following:
Point PointCollection::deletePoint(int Index)
{
    Point deleted = Point(this[Index].Id, this[Index].X, this[Index].Y);
    this->remove(Index);
    updateCentroid();
    return(deleted);
}
Point PointCollection::deletePoint(Point point)
{
    Point deleted = Point(point.GetId(), point.GetX(), point.GetY());
    this->remove(point);
    updateCentroid();
    return(deleted);
}
Now Point PointCollection::deletePoint(int Index) compiles without any error, but this->remove(point); in Point PointCollection::deletePoint(Point point) functioned is compiled with following error:
error: no matching function for call to 'PointCollection::remove(Point&)'
Q1: Did I do correct that removed new?
Q2: How to fix the error I am having.
 
    