mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-13 17:44:48 -07:00
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:
parent
ad06814ac7
commit
3b758962e4
10 changed files with 116 additions and 40 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue