aboutsummaryrefslogtreecommitdiffstats
path: root/subsurface-helper.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-09-28 23:31:40 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-10-04 09:19:10 -0700
commit3db50aedeaea94b7395fe6fcdb56bda9bee2f2cb (patch)
treeff4de197788d1122bba31f8d5cea67357a6ff3df /subsurface-helper.cpp
parent2a9a3dda20c47e74746fbfa3c6e5fd9ee919b2b3 (diff)
downloadsubsurface-3db50aedeaea94b7395fe6fcdb56bda9bee2f2cb.tar.gz
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>
Diffstat (limited to 'subsurface-helper.cpp')
-rw-r--r--subsurface-helper.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/subsurface-helper.cpp b/subsurface-helper.cpp
index 26e58ece9..c389e2099 100644
--- a/subsurface-helper.cpp
+++ b/subsurface-helper.cpp
@@ -96,14 +96,13 @@ void run_ui()
qDebug() << "QML import path" << engine.importPathList();
#endif // __APPLE__ not Q_OS_IOS
engine.addImportPath("qrc://imports");
- DiveListSortModel *sortModel = new DiveListSortModel(0);
QSortFilterProxyModel *gpsSortModel = new QSortFilterProxyModel(nullptr);
gpsSortModel->setSourceModel(GpsListModel::instance());
gpsSortModel->setDynamicSortFilter(true);
gpsSortModel->setSortRole(GpsListModel::GpsWhenRole);
gpsSortModel->sort(0, Qt::DescendingOrder);
QQmlContext *ctxt = engine.rootContext();
- ctxt->setContextProperty("diveModel", sortModel);
+ ctxt->setContextProperty("diveModel", DiveListSortModel::instance());
ctxt->setContextProperty("gpsModel", gpsSortModel);
ctxt->setContextProperty("vendorList", vendorList);
set_non_bt_addresses();
@@ -135,7 +134,6 @@ void run_ui()
LOG_STP("run_ui show_computer_list");
manager->setDevicePixelRatio(qml_window->devicePixelRatio(), qml_window->screen());
- manager->dlSortModel = sortModel;
manager->qmlWindow = qqWindowObject;
manager->screenChanged(screen);
qDebug() << "qqwindow screen has ldpi/pdpi" << screen->logicalDotsPerInch() << screen->physicalDotsPerInch();