summaryrefslogtreecommitdiffstats
path: root/qt-ui/divelistview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r--qt-ui/divelistview.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index cbd62408b..a37b6ba3b 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -47,16 +47,19 @@ void DiveListView::unselectDives()
selectionModel()->clearSelection();
}
-void DiveListView::selectDive(struct dive *dive, bool scrollto)
+void DiveListView::selectDive(struct dive *dive, bool scrollto, bool toggle)
{
QSortFilterProxyModel *m = qobject_cast<QSortFilterProxyModel*>(model());
QModelIndexList match = m->match(m->index(0,0), TreeItemDT::NR, dive->number, 1, Qt::MatchRecursive);
+ QFlags<QItemSelectionModel::SelectionFlag> flags;
QModelIndex idx = match.first();
QModelIndex parent = idx.parent();
if (parent.isValid())
expand(parent);
- selectionModel()->select( idx, QItemSelectionModel::Select | QItemSelectionModel::Rows);
+ flags = toggle ? QItemSelectionModel::Toggle : QItemSelectionModel::Select;
+ flags |= QItemSelectionModel::Rows;
+ selectionModel()->select( idx, flags);
if (scrollto)
scrollTo(idx, PositionAtCenter);
}