In the above examples we provided our own LessThan-function, so we were using this qsort definition:

Qt Code:
  1. template <typename RandomAccessIterator, typename LessThan>
  2. inline void qSort(RandomAccessIterator start, RandomAccessIterator end, LessThan lessThan)
To copy to clipboard, switch view to plain text mode 

The third argument is a function pointer to a user-defined-function with two parameters of the container type, that returns true only if the first argument is "less" than the second.

Qt Code:
  1. bool compareNames(const T &t1, const T &t2) const ..
To copy to clipboard, switch view to plain text mode 

So you do not give any parameters to compareNames. You just call:

Qt Code:
  1. qSort(strlist.begin(),strlist.end(),compareNames);
To copy to clipboard, switch view to plain text mode 

qSort then calls compareNames each time it needs to establish the order of two strings while sorting the whole thing.

HIH

Johannes