template <typename RandomAccessIterator, typename LessThan> void qSort(RandomAccessIterator begin, RandomAccessIterator end, LessThan lessThan)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
This is an overloaded function.
Use std::sort instead.
在Qt的帮助文档中搜索“qSort”,发现 qSort 已经被不建议使用,建议使用std::sort;
QList<int> rows {1, 21, 3, 6, 5, 6};
//std::sort(rows.begin(), rows.end());//从小到大
std::sort(rows.begin(), rows.end(), std::greater<int>());//从大到小
for(int row : rows)
{
qDebug() << row;
}
输出
21
6
6
5
3
1
5219

被折叠的 条评论
为什么被折叠?



