fix #LINQT-2108 : do not use <= or >= in lessThan comparator (c++ restriction)

This commit is contained in:
Gaelle Braud 2025-11-05 11:05:38 +01:00
parent 99c2a6ddc6
commit 6f4e925766
3 changed files with 3 additions and 3 deletions

View file

@ -83,6 +83,6 @@ bool ChatProxy::SortFilterList::lessThan(const QModelIndex &sourceLeft, const QM
if (!mFilterText.isEmpty()) return false;
auto l = getItemAtSource<ChatList, ChatCore>(sourceLeft.row());
auto r = getItemAtSource<ChatList, ChatCore>(sourceRight.row());
if (l && r) return l->getLastUpdatedTime() >= r->getLastUpdatedTime();
if (l && r) return l->getLastUpdatedTime() > r->getLastUpdatedTime();
return false;
}

View file

@ -152,6 +152,6 @@ bool EventLogProxy::SortFilterList::filterAcceptsRow(int sourceRow, const QModel
bool EventLogProxy::SortFilterList::lessThan(const QModelIndex &sourceLeft, const QModelIndex &sourceRight) const {
auto l = getItemAtSource<EventLogList, EventLogCore>(sourceLeft.row());
auto r = getItemAtSource<EventLogList, EventLogCore>(sourceRight.row());
if (l && r) return l->getTimestamp() <= r->getTimestamp();
if (l && r) return l->getTimestamp() < r->getTimestamp();
return true;
}

View file

@ -150,7 +150,7 @@ bool ConferenceInfoProxy::SortFilterList::lessThan(const QModelIndex &sourceLeft
auto nowDate = QDate::currentDate();
if (!l || !r) { // sort on date
auto rdate = r ? r->getDateTimeUtc().date() : QDate::currentDate();
return !l ? nowDate <= r->getDateTimeUtc().date() : l->getDateTimeUtc().date() < nowDate;
return !l ? nowDate < r->getDateTimeUtc().date() : l->getDateTimeUtc().date() < nowDate;
} else {
return l->getDateTimeUtc() < r->getDateTimeUtc();
}