Select new entry after cloning

Also fixes re-selecting entries during a search refresh
This commit is contained in:
Akinori MUSHA authored and Jonathan White committed 2023-02-13 23:22:13 -08:00
1 parent b4be71d967
commit cc35bf2096
7 files changed
+59 -41

No files matched your search

+5 -2
View File
@@ -279,8 +279,11 @@ int EntryView::numberOfSelectedEntries()
void EntryView::setCurrentEntry(Entry* entry)
{
selectionModel()->setCurrentIndex(m_sortModel->mapFromSource(m_model->indexFromEntry(entry)),
QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
auto index = m_model->indexFromEntry(entry);
if (index.isValid()) {
selectionModel()->setCurrentIndex(m_sortModel->mapFromSource(index),
QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
}
}
Entry* EntryView::entryFromIndex(const QModelIndex& index)