diff options
Diffstat (limited to 'desktop-widgets/divelistview.cpp')
-rw-r--r-- | desktop-widgets/divelistview.cpp | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp index ee0c1c98f..76fa8fbd8 100644 --- a/desktop-widgets/divelistview.cpp +++ b/desktop-widgets/divelistview.cpp @@ -49,9 +49,6 @@ DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), resetModel(); - // Update selection if all selected dives were hidden by filter - connect(&diveListNotifier, &DiveListNotifier::filterReset, this, &DiveListView::filterFinished); - connect(&diveListNotifier, &DiveListNotifier::tripChanged, this, &DiveListView::tripChanged); header()->setStretchLastSection(true); @@ -273,26 +270,6 @@ void DiveListView::selectTrip(dive_trip_t *trip) expand(idx); } -// this is an odd one - when filtering the dive list the selection status of the trips -// is kept - but all other selections are lost. That's gets us into rather inconsistent state -// we call this function which clears the selection state of the trips as well, but does so -// without updating our internal "->selected" state. So once we called this function we can -// go back and select those dives that are still visible under the filter and everything -// works as expected -void DiveListView::clearTripSelection() -{ - // This marks the selection change as being internal - ie. we don't process it further. - // TODO: This should probably be done differently. - auto marker = diveListNotifier.enterCommand(); - - // we want to make sure no trips are selected - Q_FOREACH (const QModelIndex &index, selectionModel()->selectedRows()) { - if (!index.data(DiveTripModelBase::IS_TRIP_ROLE).toBool()) - continue; - selectionModel()->select(index, QItemSelectionModel::Deselect); - } -} - void DiveListView::unselectDives() { // make sure we don't try to redraw the dives during the selection change @@ -1019,19 +996,6 @@ void DiveListView::loadImageFromURL(QUrl url) } } -void DiveListView::filterFinished() -{ - // first make sure the trips are no longer shown as selected - // (but without updating the selection state of the dives... this just cleans - // up an oddity in the filter handling) - clearTripSelection(); - - // If there are no more selected dives, select the first visible dive - if (!selectionModel()->hasSelection()) - select_newest_visible_dive(); - emit divesSelected(); -} - QString DiveListView::lastUsedImageDir() { QSettings settings; |