Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何按 QDateTime 对象的值对 QDateTime* 对象的 QList 进行排序?
您可以使用qSort自己的比较功能:
qSort
#include <QtAlgorithms> bool dtcomp(QDateTime* left, QDateTime *right) { return *left < *right; } QList<DateTime*> dtlist = ...; qSort(dtlist.begin(), dtlist.end(), dtcomp);