From 2560734624d404728b28ff7c5e7e34a1006a4b36 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 28 Sep 2019 23:01:37 +0200 Subject: Cleanup: initialize DiveListSortModel in constructor The model was initialized in the global run_ui() function. Move that into the constructor of the class. Signed-off-by: Berthold Stoeger --- qt-models/divelistmodel.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'qt-models') diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp index 9aa78f344..39f8fbc47 100644 --- a/qt-models/divelistmodel.cpp +++ b/qt-models/divelistmodel.cpp @@ -3,11 +3,17 @@ #include "core/qthelper.h" #include "core/trip.h" #include "core/settings/qPrefGeneral.h" +#include "core/ssrf.h" // for LOG_STP #include DiveListSortModel::DiveListSortModel(QObject *parent) : QSortFilterProxyModel(parent) { + setSourceModel(DiveListModel::instance()); + setDynamicSortFilter(true); + setSortRole(DiveListModel::DiveDateRole); + sort(0, Qt::DescendingOrder); updateFilterState(); + LOG_STP("run_ui diveListModel sorted"); } void DiveListSortModel::updateFilterState() -- cgit v1.2.3-70-g09d2