diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-12-09 09:46:08 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-12-10 18:45:30 -0800 |
commit | 71307bce42af3070c9f2ff32f52e289cb6c3a64d (patch) | |
tree | f743f6c9c5f2b3f91741d1eb4d47a795b4cdbc26 /desktop-widgets/divelistview.cpp | |
parent | 9ea46f196adec41afffe8670a647dd04c4519b99 (diff) | |
download | subsurface-71307bce42af3070c9f2ff32f52e289cb6c3a64d.tar.gz |
Dive list: don't handle selection changes on filter-change in view
The selection changes upon completing the filter are handled by
the core. Don't do this explicitly in the DiveListView.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
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; |