diff --git a/cockatrice/src/client/ui/widgets/visual_deck_storage/visual_deck_storage_tag_filter_widget.cpp b/cockatrice/src/client/ui/widgets/visual_deck_storage/visual_deck_storage_tag_filter_widget.cpp index ba4f15a8c..25cb5a1e5 100644 --- a/cockatrice/src/client/ui/widgets/visual_deck_storage/visual_deck_storage_tag_filter_widget.cpp +++ b/cockatrice/src/client/ui/widgets/visual_deck_storage/visual_deck_storage_tag_filter_widget.cpp @@ -64,13 +64,13 @@ void VisualDeckStorageTagFilterWidget::filterDecksBySelectedTags(const QList allTags = gatherAllTags(); removeTagsNotInList(allTags); addTagsIfNotPresent(allTags); sortTags(); } -void VisualDeckStorageTagFilterWidget::removeTagsNotInList(const QStringList &tags) +void VisualDeckStorageTagFilterWidget::removeTagsNotInList(const QSet &tags) { // Iterate through all DeckPreviewTagDisplayWidgets for (DeckPreviewTagDisplayWidget *tagWidget : findChildren()) { @@ -83,7 +83,7 @@ void VisualDeckStorageTagFilterWidget::removeTagsNotInList(const QStringList &ta } } -void VisualDeckStorageTagFilterWidget::addTagsIfNotPresent(const QStringList &tags) +void VisualDeckStorageTagFilterWidget::addTagsIfNotPresent(const QSet &tags) { for (const QString &tag : tags) { addTagIfNotPresent(tag); @@ -136,14 +136,16 @@ void VisualDeckStorageTagFilterWidget::sortTags() } } -QStringList VisualDeckStorageTagFilterWidget::gatherAllTags() const +QSet VisualDeckStorageTagFilterWidget::gatherAllTags() const { - QStringList allTags; + QSet allTags; QList deckWidgets = parent->findChildren(); for (DeckPreviewWidget *widget : deckWidgets) { if (widget->checkVisibility()) { - allTags << widget->deckLoader->getTags(); + for (const QString &tag : widget->deckLoader->getTags()) { + allTags.insert(tag); + } } } return allTags; diff --git a/cockatrice/src/client/ui/widgets/visual_deck_storage/visual_deck_storage_tag_filter_widget.h b/cockatrice/src/client/ui/widgets/visual_deck_storage/visual_deck_storage_tag_filter_widget.h index 8c1256656..3198e9769 100644 --- a/cockatrice/src/client/ui/widgets/visual_deck_storage/visual_deck_storage_tag_filter_widget.h +++ b/cockatrice/src/client/ui/widgets/visual_deck_storage/visual_deck_storage_tag_filter_widget.h @@ -12,9 +12,9 @@ class VisualDeckStorageTagFilterWidget : public QWidget VisualDeckStorageWidget *parent; - QStringList gatherAllTags() const; - void removeTagsNotInList(const QStringList &tags); - void addTagsIfNotPresent(const QStringList &tags); + QSet gatherAllTags() const; + void removeTagsNotInList(const QSet &tags); + void addTagsIfNotPresent(const QSet &tags); void addTagIfNotPresent(const QString &tag); void sortTags();