Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
CardAmountWidget Class Reference

#include <card_amount_widget.h>

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

Public Slots

void updateCardCount ()
 Updates the card count display in the widget.
void addPrinting (const QString &zone)
 Adds a printing of the card to the specified zone (Mainboard or Sideboard).

Signals

void deckModified (const QString &modificationReason)

Public Member Functions

 CardAmountWidget (QWidget *parent, AbstractTabDeckEditor *deckEditor, DeckListModel *deckModel, QTreeView *deckView, QSlider *cardSizeSlider, const ExactCard &rootCard, const QString &zoneName)
 Constructs a widget for displaying and controlling the card count in a specific zone.
int countCardsInZone (const QString &deckZone)
 Counts the number of cards in a specific zone (mainboard or sideboard).

Protected Member Functions

void paintEvent (QPaintEvent *event) override
 Handles the painting of the widget, drawing a semi-transparent background.
void showEvent (QShowEvent *event) override

Private Slots

void addPrintingMainboard ()
 Adds a printing to the mainboard zone.
void addPrintingSideboard ()
 Adds a printing to the sideboard zone.
void removePrintingMainboard ()
 Removes a printing from the mainboard zone.
void removePrintingSideboard ()
 Removes a printing from the sideboard zone.
void adjustFontSize (int scalePercentage)
 Adjusts the font size of the card count label based on the slider value.

Private Member Functions

void offsetCountAtIndex (const QModelIndex &idx, int offset)
 Offsets the card count at the specified index by the given amount.
void decrementCardHelper (const QString &zoneName)
 Helper function to decrement the card count for a given zone.
void recursiveExpand (const QModelIndex &index)
 Recursively expands the card in the deck view starting from the given index.

Private Attributes

AbstractTabDeckEditordeckEditor
DeckListModeldeckModel
QTreeView * deckView
QSlider * cardSizeSlider
ExactCard rootCard
QString zoneName
QHBoxLayout * layout
DynamicFontSizePushButtonincrementButton
DynamicFontSizePushButtondecrementButton
QLabel * cardCountInZone
bool hovered

Constructor & Destructor Documentation

◆ CardAmountWidget()

CardAmountWidget::CardAmountWidget ( QWidget * parent,
AbstractTabDeckEditor * deckEditor,
DeckListModel * deckModel,
QTreeView * deckView,
QSlider * cardSizeSlider,
const ExactCard & rootCard,
const QString & zoneName )
explicit

Constructs a widget for displaying and controlling the card count in a specific zone.

Parameters
parentThe parent widget.
deckEditorPointer to the TabDeckEditor instance.
deckModelPointer to the DeckListModel instance.
deckViewPointer to the QTreeView displaying the deck.
cardSizeSliderPointer to the QSlider for adjusting font size.
rootCardThe root card to manage within the widget.
zoneNameThe zone name (e.g., DECK_ZONE_MAIN or DECK_ZONE_SIDE).
Here is the call graph for this function:

Member Function Documentation

◆ addPrinting

void CardAmountWidget::addPrinting ( const QString & zone)
slot

Adds a printing of the card to the specified zone (Mainboard or Sideboard).

Parameters
zoneThe zone to add the card to (DECK_ZONE_MAIN or DECK_ZONE_SIDE).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addPrintingMainboard

void CardAmountWidget::addPrintingMainboard ( )
privateslot

Adds a printing to the mainboard zone.

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

◆ addPrintingSideboard

void CardAmountWidget::addPrintingSideboard ( )
privateslot

Adds a printing to the sideboard zone.

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

◆ adjustFontSize

void CardAmountWidget::adjustFontSize ( int scalePercentage)
privateslot

Adjusts the font size of the card count label based on the slider value.

Parameters
scalePercentageThe percentage value from the slider for scaling the font size.

< Minimum font size

< Maximum font size

< Scale at 100%

Here is the caller graph for this function:

◆ countCardsInZone()

int CardAmountWidget::countCardsInZone ( const QString & deckZone)

Counts the number of cards in a specific zone (mainboard or sideboard).

Parameters
deckZoneThe name of the zone (e.g., DECK_ZONE_MAIN or DECK_ZONE_SIDE).
Returns
The number of cards in the zone.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deckModified

void CardAmountWidget::deckModified ( const QString & modificationReason)
signal
Here is the caller graph for this function:

◆ decrementCardHelper()

void CardAmountWidget::decrementCardHelper ( const QString & zone)
private

Helper function to decrement the card count for a given zone.

Parameters
zoneThe zone from which to remove the card (DECK_ZONE_MAIN or DECK_ZONE_SIDE).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ offsetCountAtIndex()

void CardAmountWidget::offsetCountAtIndex ( const QModelIndex & idx,
int offset )
private

Offsets the card count at the specified index by the given amount.

Parameters
idxThe model index of the card.
offsetThe amount to add or subtract from the card count.
Here is the caller graph for this function:

◆ paintEvent()

void CardAmountWidget::paintEvent ( QPaintEvent * event)
overrideprotected

Handles the painting of the widget, drawing a semi-transparent background.

Parameters
eventThe paint event.

◆ recursiveExpand()

void CardAmountWidget::recursiveExpand ( const QModelIndex & index)
private

Recursively expands the card in the deck view starting from the given index.

Parameters
indexThe model index of the card to expand.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removePrintingMainboard

void CardAmountWidget::removePrintingMainboard ( )
privateslot

Removes a printing from the mainboard zone.

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

◆ removePrintingSideboard

void CardAmountWidget::removePrintingSideboard ( )
privateslot

Removes a printing from the sideboard zone.

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

◆ showEvent()

void CardAmountWidget::showEvent ( QShowEvent * event)
overrideprotected
Here is the call graph for this function:

◆ updateCardCount

void CardAmountWidget::updateCardCount ( )
slot

Updates the card count display in the widget.

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

Member Data Documentation

◆ cardCountInZone

QLabel* CardAmountWidget::cardCountInZone
private

◆ cardSizeSlider

QSlider* CardAmountWidget::cardSizeSlider
private

◆ deckEditor

AbstractTabDeckEditor* CardAmountWidget::deckEditor
private

◆ deckModel

DeckListModel* CardAmountWidget::deckModel
private

◆ deckView

QTreeView* CardAmountWidget::deckView
private

◆ decrementButton

DynamicFontSizePushButton* CardAmountWidget::decrementButton
private

◆ hovered

bool CardAmountWidget::hovered
private

◆ incrementButton

DynamicFontSizePushButton* CardAmountWidget::incrementButton
private

◆ layout

QHBoxLayout* CardAmountWidget::layout
private

◆ rootCard

ExactCard CardAmountWidget::rootCard
private

◆ zoneName

QString CardAmountWidget::zoneName
private

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