mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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>
This commit is contained in:
parent
9ea46f196a
commit
71307bce42
2 changed files with 0 additions and 38 deletions
|
@ -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;
|
||||
|
|
|
@ -30,7 +30,6 @@ public:
|
|||
void reload(); // Call to reload model data
|
||||
bool eventFilter(QObject *, QEvent *);
|
||||
void unselectDives();
|
||||
void clearTripSelection();
|
||||
void selectDive(QModelIndex index, bool scrollto = false);
|
||||
void selectDive(int dive_table_idx, bool scrollto = false);
|
||||
void selectDives(const QList<int> &newDiveSelection);
|
||||
|
@ -63,7 +62,6 @@ slots:
|
|||
void loadWebImages();
|
||||
void diveSelectionChanged(const QVector<QModelIndex> &indexes);
|
||||
void currentDiveChanged(QModelIndex index);
|
||||
void filterFinished();
|
||||
void tripChanged(dive_trip *trip, TripField);
|
||||
private:
|
||||
void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags flags) override;
|
||||
|
|
Loading…
Reference in a new issue