twinkle
twinkle copied to clipboard
qt5+: Replace `qSort()` with `std::sort()`
qSort() (along with a good portion of QtAlgorithms) was deprecated
in Qt 5.2, in favor of using STL algorithms instead.
Note that std::sort is not an exact drop-in replacement for qSort,
due to the following differences:
qSortcan take a Qt container as argumentqSortwill automatically useqLess<T>if definedstd::sortrequires the comparison functor to honour Strict Weak Ordering
The first two points don't apply to us; we never call qSort with a
container, nor do we ever specialize qLess<T> anywhere.
As for the last point, since AddressTableModel::sort() eventually
delegates its job to the < and > operators (defaulting to false),
it can never return true for both a comparison and its opposite, thus
satisfying Strict Weak Ordering.
Note: This was motivated by the fact that qSort() is no longer available in Qt 6 (#297).