Cockatrice 2026-09-01-Development-3.1.0-beta.10
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
CardCompleterDelegate Class Reference

Paints styled card completer popup rows. More...

#include <card_completer_delegate.h>

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

Public Member Functions

 CardCompleterDelegate (QObject *parent=nullptr)
void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
QSize sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const override

Private Member Functions

void drawManaSymbol (QPainter *p, QPoint centre, const QString &symbol, int radius) const
int drawManaCost (QPainter *p, const QRect &row, const QString &manaCost, int radius) const
QString setCodeForCard (const QSharedPointer< CardInfo > &card) const

Static Private Member Functions

static QColor accentForColors (const QString &colors)

Private Attributes

QCache< QString, QString > setCodeCache

Static Private Attributes

static constexpr int CardRowHeight = 40
static constexpr int AccentBarWidth = 5
static constexpr int SymbolRadius = 9
static constexpr int SymbolSpacing = 2
static constexpr int PartGap = 14

Detailed Description

Paints styled card completer popup rows.

Each row shows the card name, type line, set code and mana cost pips, color-coded by the card's color identity. Card data is read directly from the CardSearchModel::CardInfoRole so no extra database lookups are needed.

Constructor & Destructor Documentation

◆ CardCompleterDelegate()

CardCompleterDelegate::CardCompleterDelegate ( QObject * parent = nullptr)
explicit

Member Function Documentation

◆ accentForColors()

QColor CardCompleterDelegate::accentForColors ( const QString & colors)
staticprivate
Here is the caller graph for this function:

◆ drawManaCost()

int CardCompleterDelegate::drawManaCost ( QPainter * p,
const QRect & row,
const QString & manaCost,
int radius ) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawManaSymbol()

void CardCompleterDelegate::drawManaSymbol ( QPainter * p,
QPoint centre,
const QString & symbol,
int radius ) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ paint()

void CardCompleterDelegate::paint ( QPainter * painter,
const QStyleOptionViewItem & option,
const QModelIndex & index ) const
override
Here is the call graph for this function:

◆ setCodeForCard()

QString CardCompleterDelegate::setCodeForCard ( const QSharedPointer< CardInfo > & card) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sizeHint()

QSize CardCompleterDelegate::sizeHint ( const QStyleOptionViewItem & option,
const QModelIndex & index ) const
override

Member Data Documentation

◆ AccentBarWidth

int CardCompleterDelegate::AccentBarWidth = 5
staticconstexprprivate

◆ CardRowHeight

int CardCompleterDelegate::CardRowHeight = 40
staticconstexprprivate

◆ PartGap

int CardCompleterDelegate::PartGap = 14
staticconstexprprivate

◆ setCodeCache

QCache<QString, QString> CardCompleterDelegate::setCodeCache
mutableprivate

◆ SymbolRadius

int CardCompleterDelegate::SymbolRadius = 9
staticconstexprprivate

◆ SymbolSpacing

int CardCompleterDelegate::SymbolSpacing = 2
staticconstexprprivate

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