From ade58079a0a3e6b9d1a0793ab4c084d0f9431f4d Mon Sep 17 00:00:00 2001 From: Mark Rowe Date: Fri, 24 Oct 2025 08:21:26 -0700 Subject: Update FilterEdit and FilterTarget to preserve existing selections The down and enter keys now preserve an existing selection in the associated list or table views, rather than unconditionally selecting or activating the first item. --- examples/triage/entry.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'examples/triage/entry.cpp') diff --git a/examples/triage/entry.cpp b/examples/triage/entry.cpp index c62b9c36..98e5cff9 100644 --- a/examples/triage/entry.cpp +++ b/examples/triage/entry.cpp @@ -271,15 +271,18 @@ void EntryTreeView::scrollToCurrentItem() } -void EntryTreeView::selectFirstItem() +void EntryTreeView::ensureSelection() { - setCurrentIndex(m_model->index(0, 0, QModelIndex())); + if (auto current = currentIndex(); !current.isValid()) + setCurrentIndex(m_model->index(0, 0, QModelIndex())); } -void EntryTreeView::activateFirstItem() +void EntryTreeView::activateSelection() { - entryDoubleClicked(m_model->index(0, 0, QModelIndex())); + ensureSelection(); + if (auto current = currentIndex(); current.isValid()) + entryDoubleClicked(current); } -- cgit v1.3.1