I have a vector of pointers to structs, and want to check for existing items and sort by the value of a struct member. However, it appears that the check for existing items (I'm using QVector::indexOf()) is not working, and that std::sort is applying its sorting to some pointer value rather than the member value. I don't understand why the struct operator overloads aren't getting called (or called properly).
In header file:
struct PlotColumn {
    quint32 octagonLength;
    QVector<Qt::GlobalColor> columnVector;
    bool operator< (const PlotColumn& pc) const
    {
        return (this->octagonLength < pc.octagonLength);
    }
    bool operator==(PlotColumn const& pc)
    {
        return this->octagonLength == pc.octagonLength;
    }
    bool operator> (const PlotColumn& pc) const
    {
        return (this->octagonLength > pc.octagonLength);
    }
};
QVector<PlotColumn*> *plotMap;
In source file:
PlotColumn *pcNew = new PlotColumn();
pcNew->octagonLength = octagonLength;
// check if octagonLength has arrived before:
int plotXAxis = plotMap->indexOf(pcNew);
if (plotXAxis == -1) { // unknown, so insert:
     ... (some housekeeping)
     plotMap->append(pcNew);
     std::sort(plotMap->begin(), plotMap->end());
     ....
     (some more housekeeping)
}
Using an external (not in the struct) is possible for sort, but not for indexOf (afaik).
Any thoughts?
PS: yes I know there are tons of already answered questions about sorting vectors of pointers to structs and I've tried to apply the pattern in those solutions but it still doesn't work.
 
     
    