mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
[Card DB Models] Move refactor (#6172)
* 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>
This commit is contained in:
parent
217646f031
commit
23612ba6ec
25 changed files with 315 additions and 281 deletions
19
cockatrice/src/database/model/token/token_edit_model.cpp
Normal file
19
cockatrice/src/database/model/token/token_edit_model.cpp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue