Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
CardSearchModel Class Reference

#include <card_search_model.h>

Inheritance diagram for CardSearchModel:
[legend]
Collaboration diagram for CardSearchModel:
[legend]

Classes

struct  SearchResult

Public Types

enum  CardSearchRoles { CardInfoRole = Qt::UserRole + 1 }

Public Member Functions

 CardSearchModel (CardDatabaseDisplayModel *sourceModel, QObject *parent=nullptr)
int rowCount (const QModelIndex &parent=QModelIndex()) const override
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
void updateSearchResults (const QString &query)
void setSearchLanguage (const CardSearchLanguage &searchLang)

Private Member Functions

QStringList searchableNames (const CardInfoPtr &card) const
 The names a card is searched by with the current search language.
QString sortableName (const CardInfoPtr &card) const
 The name used to break distance ties when sorting suggestions.

Private Attributes

CardDatabaseDisplayModel * sourceModel
QList< SearchResult > searchResults
CardSearchLanguage searchLanguage

Member Enumeration Documentation

◆ CardSearchRoles

Enumerator
CardInfoRole 

Constructor & Destructor Documentation

◆ CardSearchModel()

CardSearchModel::CardSearchModel ( CardDatabaseDisplayModel * sourceModel,
QObject * parent = nullptr )
explicit
Here is the caller graph for this function:

Member Function Documentation

◆ data()

QVariant CardSearchModel::data ( const QModelIndex & index,
int role = Qt::DisplayRole ) const
nodiscardoverride

◆ rowCount()

int CardSearchModel::rowCount ( const QModelIndex & parent = QModelIndex()) const
nodiscardoverride
Here is the caller graph for this function:

◆ searchableNames()

QStringList CardSearchModel::searchableNames ( const CardInfoPtr & card) const
nodiscardprivate

The names a card is searched by with the current search language.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSearchLanguage()

void CardSearchModel::setSearchLanguage ( const CardSearchLanguage & searchLang)
inline

◆ sortableName()

QString CardSearchModel::sortableName ( const CardInfoPtr & card) const
nodiscardprivate

The name used to break distance ties when sorting suggestions.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateSearchResults()

void CardSearchModel::updateSearchResults ( const QString & query)
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ searchLanguage

CardSearchLanguage CardSearchModel::searchLanguage
private

◆ searchResults

QList<SearchResult> CardSearchModel::searchResults
private

◆ sourceModel

CardDatabaseDisplayModel* CardSearchModel::sourceModel
private

The documentation for this class was generated from the following files: