diff options
Diffstat (limited to 'examples/triage/imports.cpp')
| -rw-r--r-- | examples/triage/imports.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/examples/triage/imports.cpp b/examples/triage/imports.cpp index ea4fe5d3..19c6a62b 100644 --- a/examples/triage/imports.cpp +++ b/examples/triage/imports.cpp @@ -343,15 +343,18 @@ void ImportsTreeView::scrollToCurrentItem() } -void ImportsTreeView::selectFirstItem() +void ImportsTreeView::ensureSelection() { - setCurrentIndex(m_model->index(0, 0, QModelIndex())); + if (auto current = currentIndex(); !current.isValid()) + setCurrentIndex(m_model->index(0, 0, QModelIndex())); } -void ImportsTreeView::activateFirstItem() +void ImportsTreeView::activateSelection() { - importDoubleClicked(m_model->index(0, 0, QModelIndex())); + ensureSelection(); + if (auto current = currentIndex(); current.isValid()) + importDoubleClicked(current); } |
