From 368e13fac38e22b5c0ce4669de63dcdadbb31116 Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Thu, 29 Jul 2021 20:49:37 -0400 Subject: [PATCH] Use built-in sorting so that dynamic updates work --- src/ReadReceiptsModel.cpp | 9 ++------- src/ReadReceiptsModel.h | 2 -- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/ReadReceiptsModel.cpp b/src/ReadReceiptsModel.cpp index 0be22be2..d8b7141f 100644 --- a/src/ReadReceiptsModel.cpp +++ b/src/ReadReceiptsModel.cpp @@ -125,11 +125,6 @@ ReadReceiptsProxy::ReadReceiptsProxy(QString event_id, QString room_id, QObject { setSourceModel(&model_); setSortRole(ReadReceiptsModel::RawTimestamp); -} - -bool -ReadReceiptsProxy::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const -{ - // since we are sorting from greatest to least timestamp, return something that looks totally backwards! - return source_left.data().toULongLong() > source_right.data().toULongLong(); + sort(0, Qt::DescendingOrder); + setDynamicSortFilter(true); } diff --git a/src/ReadReceiptsModel.h b/src/ReadReceiptsModel.h index 9e26bcd5..3b45716c 100644 --- a/src/ReadReceiptsModel.h +++ b/src/ReadReceiptsModel.h @@ -63,8 +63,6 @@ public: QString eventId() const { return event_id_; } QString roomId() const { return room_id_; } - bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const; - private: QString event_id_; QString room_id_;