mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
* Refactor CardDatabaseDisplayModel, TokenDisplayModel and TokenEditModel out of CardDatabaseModel. Move every model into an appropriate folder. Took 54 minutes * No folder for database models. Took 6 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
19 lines
No EOL
618 B
C++
19 lines
No EOL
618 B
C++
#include "token_edit_model.h"
|
|
|
|
#include "../card_database_model.h"
|
|
|
|
TokenEditModel::TokenEditModel(QObject *parent) : CardDatabaseDisplayModel(parent)
|
|
{
|
|
}
|
|
|
|
bool TokenEditModel::filterAcceptsRow(int sourceRow, const QModelIndex & /*sourceParent*/) const
|
|
{
|
|
CardInfoPtr info = static_cast<CardDatabaseModel *>(sourceModel())->getCard(sourceRow);
|
|
return info->getIsToken() && info->getSets().contains(CardSet::TOKENS_SETNAME) && rowMatchesCardName(info);
|
|
}
|
|
|
|
int TokenEditModel::rowCount(const QModelIndex &parent) const
|
|
{
|
|
// always load all tokens at start
|
|
return QSortFilterProxyModel::rowCount(parent);
|
|
} |