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>
This commit is contained in:
Berthold Stoeger 2019-04-15 21:47:08 +02:00 committed by Dirk Hohndel
parent f09177e872
commit 5b270dd895

View file

@ -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();