QList 排序

现有结构体:

struct fileInfo
{
    QDate createTime;
    QString fileName;          
}
QList<fileInfo> fileLst;
// 对文件按时间排序
qSort(fileLst.begin(), fileLst.end(), compareBarData);

//排列判断
bool compareBarData(const fileInfo &barAmount1, const fileInfo &barAmount2)
{
    if (barAmount1.createTime < barAmount2.createTime)
    {
        return true;
    }
  return false; }
原文地址:https://www.cnblogs.com/qnkk123/p/6134604.html