Cockatrice 2026-01-14-Development-2.11.0-beta.46
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 setAmount (int _amount)
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, DeckStateManager *deckStateManager, QSlider *cardSizeSlider, const ExactCard &rootCard, const QString &zoneName)
 Constructs a widget for displaying and controlling the card count in a specific zone.
int getAmount ()

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 decrementCardHelper (const QString &zoneName)
 Helper function to decrement the card count for a given zone.

Private Attributes

DeckStateManagerdeckStateManager
QSlider * cardSizeSlider
ExactCard rootCard
QString zoneName
QHBoxLayout * layout
DynamicFontSizePushButtonincrementButton
DynamicFontSizePushButtondecrementButton
QLabel * cardCountInZone
bool hovered
int amount = 0

Constructor & Destructor Documentation

◆ CardAmountWidget()

CardAmountWidget::CardAmountWidget ( QWidget * parent,
DeckStateManager * deckStateManager,
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.
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:

◆ deckModified

void CardAmountWidget::deckModified ( const QString & modificationReason)
signal

◆ 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 caller graph for this function:

◆ getAmount()

int CardAmountWidget::getAmount ( )

◆ paintEvent()

void CardAmountWidget::paintEvent ( QPaintEvent * event)
overrideprotected

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

Parameters
eventThe paint event.

◆ 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:

◆ setAmount

void CardAmountWidget::setAmount ( int _amount)
slot
Here is the call 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 caller graph for this function:

Member Data Documentation

◆ amount

int CardAmountWidget::amount = 0
private

◆ cardCountInZone

QLabel* CardAmountWidget::cardCountInZone
private

◆ cardSizeSlider

QSlider* CardAmountWidget::cardSizeSlider
private

◆ deckStateManager

DeckStateManager* CardAmountWidget::deckStateManager
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: