remove "current" index after selection is cleared

This commit is contained in:
Martin Rotter 2021-10-15 10:11:14 +02:00
parent 0c2943e85e
commit 4854a67195

View File

@ -410,7 +410,7 @@ void MessagesView::selectionChanged(const QItemSelection& selected, const QItemS
<< current_index << "', source '"
<< mapped_current_index << "'.";
if (mapped_current_index.isValid() && selected_rows.count() == 1) {
if (mapped_current_index.isValid() && selected_rows.size() == 1) {
Message message = m_sourceModel->messageAt(m_proxyModel->mapToSource(current_index).row());
// Set this message as read only if current item
@ -424,6 +424,10 @@ void MessagesView::selectionChanged(const QItemSelection& selected, const QItemS
emit currentMessageRemoved();
}
if (selected_rows.isEmpty()) {
setCurrentIndex({});
}
if (!m_processingMouse &&
qApp->settings()->value(GROUP(Messages), SETTING(Messages::KeepCursorInCenter)).toBool()) {
scrollTo(currentIndex(), QAbstractItemView::ScrollHint::PositionAtCenter);