[DeckListModel] Fix deck hash not updating on card node add/remove

This commit is contained in:
RickyRister 2026-02-01 21:03:52 -08:00
parent d410078673
commit 6d58d111d7

View file

@ -340,6 +340,9 @@ bool DeckListModel::removeRows(int row, int count, const QModelIndex &parent)
emitRecursiveUpdates(parent); emitRecursiveUpdates(parent);
} }
deckList->refreshDeckHash();
emit deckHashChanged();
return true; return true;
} }
@ -448,8 +451,6 @@ QModelIndex DeckListModel::addCard(const ExactCard &card, const QString &zoneNam
cardNode->setCardSetShortName(cardSetName); cardNode->setCardSetShortName(cardSetName);
cardNode->setCardCollectorNumber(printingInfo.getProperty("num")); cardNode->setCardCollectorNumber(printingInfo.getProperty("num"));
cardNode->setCardProviderId(printingInfo.getProperty("uuid")); cardNode->setCardProviderId(printingInfo.getProperty("uuid"));
deckList->refreshDeckHash();
emit deckHashChanged();
// Emit dataChanged for the amount column since we modified it // Emit dataChanged for the amount column since we modified it
QModelIndex cardIndex = nodeToIndex(cardNode); QModelIndex cardIndex = nodeToIndex(cardNode);
QModelIndex amountIndex = cardIndex.sibling(cardIndex.row(), DeckListModelColumns::CARD_AMOUNT); QModelIndex amountIndex = cardIndex.sibling(cardIndex.row(), DeckListModelColumns::CARD_AMOUNT);
@ -458,6 +459,10 @@ QModelIndex DeckListModel::addCard(const ExactCard &card, const QString &zoneNam
sort(lastKnownColumn, lastKnownOrder); sort(lastKnownColumn, lastKnownOrder);
refreshCardFormatLegalities(); refreshCardFormatLegalities();
emitRecursiveUpdates(parentIndex); emitRecursiveUpdates(parentIndex);
deckList->refreshDeckHash();
emit deckHashChanged();
auto index = nodeToIndex(cardNode); auto index = nodeToIndex(cardNode);
if (cardNodeAdded) { if (cardNodeAdded) {