diff --git a/cockatrice/src/client/tabs/tab_deck_editor.cpp b/cockatrice/src/client/tabs/tab_deck_editor.cpp index 01cd911c8..a10dc91f3 100644 --- a/cockatrice/src/client/tabs/tab_deck_editor.cpp +++ b/cockatrice/src/client/tabs/tab_deck_editor.cpp @@ -1320,6 +1320,12 @@ void TabDeckEditor::actRemoveCard() { auto selectedRows = getSelectedCardNodes(); + // hack to maintain the old reselection behavior when currently selected row of a single-selection gets deleted + // TODO: remove the hack and also handle reselection when all rows of a multi-selection gets deleted + if (selectedRows.length() == 1) { + deckView->setSelectionMode(QAbstractItemView::SingleSelection); + } + bool modified = false; for (const auto &index : selectedRows) { if (!index.isValid() || deckModel->hasChildren(index)) { @@ -1329,6 +1335,8 @@ void TabDeckEditor::actRemoveCard() modified = true; } + deckView->setSelectionMode(QAbstractItemView::ExtendedSelection); + if (modified) { DeckLoader *const deck = deckModel->getDeckList(); setSaveStatus(!deck->isEmpty()); @@ -1399,9 +1407,17 @@ void TabDeckEditor::actDecrement() { auto selectedRows = getSelectedCardNodes(); + // hack to maintain the old reselection behavior when currently selected row of a single-selection gets deleted + // TODO: remove the hack and also handle reselection when all rows of a multi-selection gets deleted + if (selectedRows.length() == 1) { + deckView->setSelectionMode(QAbstractItemView::SingleSelection); + } + for (const auto &index : selectedRows) { offsetCountAtIndex(index, -1); } + + deckView->setSelectionMode(QAbstractItemView::ExtendedSelection); } void TabDeckEditor::setDeck(DeckLoader *_deck)