Add search filter to card view window (#5791)

* refactor out search syntax help window

* add search bar to ZoneViewWidget

* implement filter logic
This commit is contained in:
RickyRister 2025-04-11 20:00:46 -07:00 committed by GitHub
parent ad06814ac7
commit 3b758962e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 116 additions and 40 deletions

View file

@ -148,7 +148,16 @@ void ZoneViewZone::updateCardIds(CardAction action)
// Because of boundingRect(), this function must not be called before the zone was added to a scene.
void ZoneViewZone::reorganizeCards()
{
CardList cardsToDisplay(cards);
// filter cards
CardList cardsToDisplay = CardList(cards.getContentsKnown());
for (auto card : cards) {
if (filterString.check(card->getInfo())) {
card->show();
cardsToDisplay.append(card);
} else {
card->hide();
}
}
// sort cards
QList<CardList::SortOption> sortOptions;
@ -263,6 +272,12 @@ ZoneViewZone::GridSize ZoneViewZone::positionCardsForDisplay(CardList &cards, Ca
}
}
void ZoneViewZone::setFilterString(const QString &_filterString)
{
filterString = FilterString(_filterString);
reorganizeCards();
}
void ZoneViewZone::setGroupBy(CardList::SortOption _groupBy)
{
groupBy = _groupBy;