From 059c23f8f4e3b65c5ca5dd9f0604839e3cdebecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Sun, 1 Dec 2024 13:12:49 +0100 Subject: [PATCH] Set the index correctly when removing a non-providerId printing for a providerId printing to avoid jumping to the next card. --- .../ui/widgets/printing_selector/card_amount_widget.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/client/ui/widgets/printing_selector/card_amount_widget.cpp b/cockatrice/src/client/ui/widgets/printing_selector/card_amount_widget.cpp index 6d60e32e4..e773cccb2 100644 --- a/cockatrice/src/client/ui/widgets/printing_selector/card_amount_widget.cpp +++ b/cockatrice/src/client/ui/widgets/printing_selector/card_amount_widget.cpp @@ -87,12 +87,14 @@ void CardAmountWidget::updateCardCount() void CardAmountWidget::addPrinting(const QString &zone) { - const auto newCardIndex = deckModel->addCard(rootCard->getName(), setInfoForCard, zone); + auto newCardIndex = deckModel->addCard(rootCard->getName(), setInfoForCard, zone); recursiveExpand(newCardIndex); QModelIndex find_card = deckModel->findCard(rootCard->getName(), zone); if (find_card.isValid() && find_card != newCardIndex) { deckModel->removeRow(find_card.row(), find_card.parent()); }; + newCardIndex = deckModel->findCard(rootCard->getName(), zone, setInfoForCard.getProperty("uuid")); + deckView->setCurrentIndex(newCardIndex); deckView->setFocus(Qt::FocusReason::MouseFocusReason); }