summaryrefslogtreecommitdiff
path: root/examples/triage/entry.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/triage/entry.cpp')
-rw-r--r--examples/triage/entry.cpp11
1 files changed, 7 insertions, 4 deletions
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);
}