From 7bc34619c1c73c6ba7c339a45a751239d38580d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Fri, 6 Dec 2024 03:04:16 +0100 Subject: [PATCH] Remember how many cards were originally in deck when replacing with uuid version. --- .../ui/widgets/printing_selector/card_amount_widget.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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 e773cccb2..eb45eefd0 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 @@ -91,6 +91,12 @@ void CardAmountWidget::addPrinting(const QString &zone) recursiveExpand(newCardIndex); QModelIndex find_card = deckModel->findCard(rootCard->getName(), zone); if (find_card.isValid() && find_card != newCardIndex) { + auto amount = deckModel->data(find_card, Qt::DisplayRole); + if (amount.toInt() > 1) { + for (int i = 0; i < amount.toInt() - 1; i++) { + deckModel->addCard(rootCard->getName(), setInfoForCard, zone); + } + } deckModel->removeRow(find_card.row(), find_card.parent()); }; newCardIndex = deckModel->findCard(rootCard->getName(), zone, setInfoForCard.getProperty("uuid"));