diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-06-07 18:25:30 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-06-07 21:39:52 -0700 |
commit | 00d5ab1bdcabca68b1a03c3d414e7a8cea4168ea (patch) | |
tree | 2cc9542b9fe4924f5440399f9915f3c19c8b1d98 /qt-ui/divelistview.cpp | |
parent | ef873b40821e3bc327b67ec980d1317112d2aa87 (diff) | |
download | subsurface-00d5ab1bdcabca68b1a03c3d414e7a8cea4168ea.tar.gz |
Make a map ctrl-click toggle the selection state
This way the map selection works like normal selections do. Except we
don't do "ranged" selections (shift-click) for fairly obvious reasons.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r-- | qt-ui/divelistview.cpp | 7 |
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); } |