How do I sort a QList of QDateTime* objects by the value of the QDateTime object?
You can use qSort
with your own comparison function:
#include <QtAlgorithms>
bool dtcomp(QDateTime* left, QDateTime *right) {
return *left < *right;
}
QList<DateTime*> dtlist = ...;
qSort(dtlist.begin(), dtlist.end(), dtcomp);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With