hi all,

I have a strange prob to sort my QList with the qSort() function.

the class to be sorted looks like:
Qt Code:
  1. #ifndef MYCLASS_H
  2. #define MYCLASS_H
  3.  
  4. class MyClass{
  5. public:
  6. MyClass(){}
  7. ~MyClass{}
  8. bool operator<(const MyClass& a) const {
  9. return getBpCount() < a.getBpCount();
  10. }
  11. const float getBpCount(void) const{return /*some calculated float*/;}
  12. }
  13. #endif
To copy to clipboard, switch view to plain text mode 

in the class, where I use the class above, I do the following:
Qt Code:
  1. QList<MyClass*> *list = new QList<MyClass*>;
  2. for(){/*create new MyClasses & add to list*/}
  3.  
  4. //finally
  5. //checked the listorder here1
  6. qSort(*list);
  7. //and here2
To copy to clipboard, switch view to plain text mode 

the list should be sorted, but it isn't

there is some change between here1 & here2 but @ here2 the list isn't oredered in an ascending or descending order, it seems to be random to me

can anybody tell me what I'm missing or doing wrong???

regards