Cleanup: remove toggle parameter from DiveListView::selectDive()

This defaulted to false and no caller used anything different.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-11-28 15:49:49 +01:00 committed by bstoeger
parent 364a8270d1
commit 75dac8906e
2 changed files with 6 additions and 8 deletions

View file

@ -322,13 +322,11 @@ QList<dive_trip_t *> DiveListView::selectedTrips()
return ret; return ret;
} }
void DiveListView::selectDive(QModelIndex idx, bool scrollto, bool toggle) void DiveListView::selectDive(QModelIndex idx, bool scrollto)
{ {
if (!idx.isValid()) if (!idx.isValid())
return; return;
QItemSelectionModel::SelectionFlags flags = toggle ? QItemSelectionModel::Toggle : QItemSelectionModel::Select; selectionModel()->setCurrentIndex(idx, QItemSelectionModel::Select | QItemSelectionModel::Rows);
flags |= QItemSelectionModel::Rows;
selectionModel()->setCurrentIndex(idx, flags);
if (idx.parent().isValid()) { if (idx.parent().isValid()) {
setAnimated(false); setAnimated(false);
expand(idx.parent()); expand(idx.parent());
@ -341,7 +339,7 @@ void DiveListView::selectDive(QModelIndex idx, bool scrollto, bool toggle)
selectionChangeDone(); selectionChangeDone();
} }
void DiveListView::selectDive(int i, bool scrollto, bool toggle) void DiveListView::selectDive(int i, bool scrollto)
{ {
if (i == -1) if (i == -1)
return; return;
@ -350,7 +348,7 @@ void DiveListView::selectDive(int i, bool scrollto, bool toggle)
if (match.isEmpty()) if (match.isEmpty())
return; return;
QModelIndex idx = match.first(); QModelIndex idx = match.first();
selectDive(idx, scrollto, toggle); selectDive(idx, scrollto);
} }
void DiveListView::selectDives(const QList<int> &newDiveSelection) void DiveListView::selectDives(const QList<int> &newDiveSelection)

View file

@ -31,8 +31,8 @@ public:
bool eventFilter(QObject *, QEvent *); bool eventFilter(QObject *, QEvent *);
void unselectDives(); void unselectDives();
void clearTripSelection(); void clearTripSelection();
void selectDive(QModelIndex index, bool scrollto = false, bool toggle = false); void selectDive(QModelIndex index, bool scrollto = false);
void selectDive(int dive_table_idx, bool scrollto = false, bool toggle = false); void selectDive(int dive_table_idx, bool scrollto = false);
void selectDives(const QList<int> &newDiveSelection); void selectDives(const QList<int> &newDiveSelection);
void contextMenuEvent(QContextMenuEvent *event); void contextMenuEvent(QContextMenuEvent *event);
QList<dive_trip *> selectedTrips(); QList<dive_trip *> selectedTrips();