diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-04-15 21:47:08 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-04-16 23:46:19 +1200 |
commit | 5b270dd895a57942981a4bb9a3b0993d04f1049f (patch) | |
tree | 761a228831610d0ccb940a500a393d203ab63b16 | |
parent | f09177e87283b0d53cb2b2e20cbe086098389957 (diff) | |
download | subsurface-5b270dd895a57942981a4bb9a3b0993d04f1049f.tar.gz |
Cleanup: access filter-model directly without cast
To reset the filter-model, LocationInformationWidget would extract
the model from the diveSiteListView and then downcasts it. Instead,
it can access it directly, because the filter-model is a subobject
of LocationInformationWidget.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r-- | desktop-widgets/locationinformation.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp index fe8b6b516..a4ec0baac 100644 --- a/desktop-widgets/locationinformation.cpp +++ b/desktop-widgets/locationinformation.cpp @@ -194,10 +194,8 @@ void LocationInformationWidget::initFields(dive_site *ds) filter_model.set(ds, ds->location); updateLabels(); enableLocationButtons(dive_site_has_gps_location(ds)); - QSortFilterProxyModel *m = qobject_cast<QSortFilterProxyModel *>(ui.diveSiteListView->model()); MultiFilterSortModel::instance()->startFilterDiveSites(QVector<dive_site *>{ ds }); - if (m) - m->invalidate(); + filter_model.invalidate(); } else { filter_model.set(0, location_t { degrees_t{ 0 }, degrees_t{ 0 } }); clearLabels(); |