[DeckListModel] remove more access to underlying decklist for iteration

This commit is contained in:
RickyRister 2025-12-20 20:29:02 -08:00
parent 73a90bdf38
commit 46c99889d7
4 changed files with 16 additions and 6 deletions

View file

@ -561,6 +561,11 @@ void DeckListModel::setDeckList(DeckList *_deck)
rebuildTree();
}
void DeckListModel::forEachCard(const std::function<void(InnerDecklistNode *, DecklistCardNode *)> &func)
{
deckList->forEachCard(func);
}
static QList<ExactCard> cardNodesToExactCards(QList<const DecklistCardNode *> nodes)
{
QList<ExactCard> cards;

View file

@ -309,6 +309,13 @@ public:
}
void setDeckList(DeckList *_deck);
/**
* @brief Apply a function to every card in the deck tree.
*
* @param func Function taking (zone node, card node).
*/
void forEachCard(const std::function<void(InnerDecklistNode *, DecklistCardNode *)> &func);
/**
* @brief Creates a list consisting of the entries of the model mapped into ExactCards (with each entry looked up
* in the card database).