From 5b270dd895a57942981a4bb9a3b0993d04f1049f Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 15 Apr 2019 21:47:08 +0200 Subject: 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 --- desktop-widgets/locationinformation.cpp | 4 +--- 1 file changed, 1 insertion(+), 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(ui.diveSiteListView->model()); MultiFilterSortModel::instance()->startFilterDiveSites(QVector{ ds }); - if (m) - m->invalidate(); + filter_model.invalidate(); } else { filter_model.set(0, location_t { degrees_t{ 0 }, degrees_t{ 0 } }); clearLabels(); -- cgit v1.2.3-70-g09d2