Properly check if a duplicate already exists in the list, no longer break loop.

This commit is contained in:
Lukas Brübach 2025-01-14 16:11:05 +01:00
parent f6c1253e84
commit ea716d3e0c
2 changed files with 8 additions and 2 deletions

View file

@ -103,8 +103,9 @@ QList<CardInfoPerSet> PrintingSelectorCardSortingWidget::sortSets(const CardInfo
for (auto it = cardInfoPerSets.begin(); it != cardInfoPerSets.end(); ++it) {
for (const auto &cardInfoPerSet : it.value()) {
if (cardInfoPerSet.getPtr() == set) {
sortedCardInfoPerSets << cardInfoPerSet;
break;
if (!sortedCardInfoPerSets.contains(cardInfoPerSet)) {
sortedCardInfoPerSets << cardInfoPerSet;
}
}
}
}

View file

@ -144,6 +144,11 @@ public:
explicit CardInfoPerSet(const CardSetPtr &_set = QSharedPointer<CardSet>(nullptr));
~CardInfoPerSet() = default;
bool operator==(const CardInfoPerSet &other) const
{
return this->set == other.set && this->properties == other.properties;
}
private:
CardSetPtr set;
// per-set card properties;