summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/divelistview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets/divelistview.cpp')
-rw-r--r--desktop-widgets/divelistview.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp
index 4af42e713..29dabfa36 100644
--- a/desktop-widgets/divelistview.cpp
+++ b/desktop-widgets/divelistview.cpp
@@ -554,6 +554,19 @@ void DiveListView::mouseReleaseEvent(QMouseEvent *event)
selectionChangeDone();
}
+void DiveListView::keyPressEvent(QKeyEvent *event)
+{
+ // Hook into cursor-up and cursor-down events and update selection if necessary.
+ // See comment in mouseReleaseEvent()
+ if (event->key() != Qt::Key_Down && event->key() != Qt::Key_Up)
+ return QTreeView::keyPressEvent(event);
+ QModelIndexList selectionBefore = selectionModel()->selectedRows();
+ QTreeView::keyPressEvent(event);
+ QModelIndexList selectionAfter = selectionModel()->selectedRows();
+ if (selectionBefore != selectionAfter)
+ selectionChangeDone();
+}
+
void DiveListView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags flags)
{
// We hook into QTreeView's setSelection() to update the UI