mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cleanup: Turn DiveListSortModel into classical singleton
To make this class available from QMLManager, the run_ui() function would create the object and then set a pointer in QMLManager. It works, but is inconsistent with the rest of the code. Therefore, make it a classical singleton class, which is generated on demand. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
2a9a3dda20
commit
3db50aedea
4 changed files with 12 additions and 7 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue