diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-11-28 15:42:34 +0100 |
---|---|---|
committer | bstoeger <32835590+bstoeger@users.noreply.github.com> | 2019-12-04 13:00:23 +0100 |
commit | 364a8270d1089dcd8f3efb411568be273aa0b59a (patch) | |
tree | 8ce3656a3155e543da17962ff5d471e1bb70a21a /desktop-widgets/divelistview.cpp | |
parent | a83bc5ecdb5edc2834335f77711f8fb262ef5273 (diff) | |
download | subsurface-364a8270d1089dcd8f3efb411568be273aa0b59a.tar.gz |
Cleanup: remove DiveListView::remember/restoreSelection()
Calls of these functions were removed in the previous commits.
Now, remove the functions themselves.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/divelistview.cpp')
-rw-r--r-- | desktop-widgets/divelistview.cpp | 43 |
1 files changed, 1 insertions, 42 deletions
diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp index 326e82d5a..f1c816e63 100644 --- a/desktop-widgets/divelistview.cpp +++ b/desktop-widgets/divelistview.cpp @@ -31,7 +31,7 @@ #include "desktop-widgets/mapwidget.h" DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelection(false), - currentLayout(DiveTripModelBase::TREE), selectionSaved(false), + currentLayout(DiveTripModelBase::TREE), initialColumnWidths(DiveTripModelBase::COLUMNS, 50) // Set up with default length 50 { setItemDelegate(new DiveListDelegate(this)); @@ -239,47 +239,6 @@ void DiveListView::rowsInserted(const QModelIndex &parent, int start, int end) } } -// this only remembers dives that were selected, not trips -void DiveListView::rememberSelection() -{ - selectedDives.clear(); - QItemSelection selection = selectionModel()->selection(); - Q_FOREACH (const QModelIndex &index, selection.indexes()) { - if (index.column() != 0) // We only care about the dives, so, let's stick to rows and discard columns. - continue; - struct dive *d = index.data(DiveTripModelBase::DIVE_ROLE).value<struct dive *>(); - if (d) { - selectedDives.insert(d->divetrip, get_divenr(d)); - } else { - struct dive_trip *t = index.data(DiveTripModelBase::TRIP_ROLE).value<dive_trip *>(); - if (t) - selectedDives.insert(t, -1); - } - } - selectionSaved = true; -} - -void DiveListView::restoreSelection() -{ - if (!selectionSaved) - return; - - selectionSaved = false; - QList<int> divesToSelect; - Q_FOREACH (dive_trip_t *trip, selectedDives.keys()) { - QList<int> divesOnTrip = getDivesInTrip(trip); - QList<int> selectedDivesOnTrip = selectedDives.values(trip); - - // Only select trip if all of its dives were selected - if(selectedDivesOnTrip.contains(-1)) { - selectTrip(trip); - selectedDivesOnTrip.removeAll(-1); - } - divesToSelect += selectedDivesOnTrip; - } - selectDives(divesToSelect); -} - // This is a bit ugly: we hook directly into the tripChanged signal to // select the trip if it was edited. This feels like a layering violation: // Shouldn't the core-layer call us? |