Skip to content

Commit

Permalink
PreviewButtonDelegate: Close editor when leaving the column
Browse files Browse the repository at this point in the history
  • Loading branch information
uklotzde committed Sep 5, 2021
1 parent 07fda6b commit 64d1c73
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/library/previewbuttondelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ void PreviewButtonDelegate::cellEntered(const QModelIndex& index) {
VERIFY_OR_DEBUG_ASSERT(parentTableView()) {
return;
}
// this slot is called if the mouse pointer enters ANY cell on
// the QTableView but the code should only be executed in the
// preview button column
// Close editor if the mouse leaves the button's column
if (index.column() != m_column) {
parentTableView()->closePersistentEditor(m_currentEditedCellIndex);
m_currentEditedCellIndex = QModelIndex();
return;
}
if (m_currentEditedCellIndex.isValid()) {
Expand All @@ -189,6 +189,7 @@ void PreviewButtonDelegate::cellEntered(const QModelIndex& index) {
}
// Close the editor in the other cell
parentTableView()->closePersistentEditor(m_currentEditedCellIndex);
// m_currentEditedCellIndex will be assigned a new, valid value (see below)
}
parentTableView()->openPersistentEditor(index);
m_currentEditedCellIndex = index;
Expand Down

0 comments on commit 64d1c73

Please sign in to comment.