diff options
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/divelistmodel.cpp | 8 | ||||
-rw-r--r-- | qt-models/divelistmodel.h | 3 |
2 files changed, 9 insertions, 2 deletions
diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp index 6d94b09c9..d3c4e3ce2 100644 --- a/qt-models/divelistmodel.cpp +++ b/qt-models/divelistmodel.cpp @@ -6,7 +6,7 @@ #include "core/ssrf.h" // for LOG_STP #include <QDateTime> -DiveListSortModel::DiveListSortModel(QObject *parent) : QSortFilterProxyModel(parent) +DiveListSortModel::DiveListSortModel() { setSourceModel(DiveListModel::instance()); setDynamicSortFilter(true); @@ -16,6 +16,12 @@ DiveListSortModel::DiveListSortModel(QObject *parent) : QSortFilterProxyModel(pa LOG_STP("run_ui diveListModel sorted"); } +DiveListSortModel *DiveListSortModel::instance() +{ + static DiveListSortModel self; + return &self; +} + void DiveListSortModel::updateFilterState() { if (filterString.isEmpty()) { diff --git a/qt-models/divelistmodel.h b/qt-models/divelistmodel.h index 87c5bb254..e7fb5369c 100644 --- a/qt-models/divelistmodel.h +++ b/qt-models/divelistmodel.h @@ -11,7 +11,8 @@ class DiveListSortModel : public QSortFilterProxyModel { Q_OBJECT public: - DiveListSortModel(QObject *parent = 0); + DiveListSortModel(); + static DiveListSortModel *instance(); void setSourceModel(QAbstractItemModel *sourceModel); Q_INVOKABLE void reload(); Q_INVOKABLE QString tripTitle(const QString &trip); |