Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
card_amount_widget.h
Go to the documentation of this file.
1
7
8#ifndef CARD_AMOUNT_WIDGET_H
9#define CARD_AMOUNT_WIDGET_H
10
13
14#include <QHBoxLayout>
15#include <QLabel>
16#include <QTreeView>
17#include <QWidget>
20
21class CardAmountWidget : public QWidget
22{
23 Q_OBJECT
24
25signals:
26 void deckModified(const QString &modificationReason);
27
28public:
29 explicit CardAmountWidget(QWidget *parent,
32 QTreeView *deckView,
33 QSlider *cardSizeSlider,
34 const ExactCard &rootCard,
35 const QString &zoneName);
36 int countCardsInZone(const QString &deckZone);
37
38public slots:
39 void updateCardCount();
40 void addPrinting(const QString &zone);
41
42protected:
43 void paintEvent(QPaintEvent *event) override;
44 void showEvent(QShowEvent *event) override;
45
46private:
49 QTreeView *deckView;
52 QString zoneName;
53 QHBoxLayout *layout;
57
58 bool hovered;
59
60 void offsetCountAtIndex(const QModelIndex &idx, int offset);
61 void decrementCardHelper(const QString &zoneName);
62 void recursiveExpand(const QModelIndex &index);
63
64private slots:
69 void adjustFontSize(int scalePercentage);
70};
71
72#endif // CARD_AMOUNT_WIDGET_H
Defines the AbstractTabDeckEditor class, which provides a base for deck editor tabs in the applicatio...
AbstractTabDeckEditor is the base class for all deck editor tabs.
Definition abstract_tab_deck_editor.h:92
DynamicFontSizePushButton * decrementButton
Definition card_amount_widget.h:55
void adjustFontSize(int scalePercentage)
Adjusts the font size of the card count label based on the slider value.
Definition card_amount_widget.cpp:109
void showEvent(QShowEvent *event) override
Definition card_amount_widget.cpp:88
int countCardsInZone(const QString &deckZone)
Counts the number of cards in a specific zone (mainboard or sideboard).
Definition card_amount_widget.cpp:299
bool hovered
Definition card_amount_widget.h:58
void updateCardCount()
Updates the card count display in the widget.
Definition card_amount_widget.cpp:133
void paintEvent(QPaintEvent *event) override
Handles the painting of the widget, drawing a semi-transparent background.
Definition card_amount_widget.cpp:75
void recursiveExpand(const QModelIndex &index)
Recursively expands the card in the deck view starting from the given index.
Definition card_amount_widget.cpp:235
QHBoxLayout * layout
Definition card_amount_widget.h:53
void removePrintingSideboard()
Removes a printing from the sideboard zone.
Definition card_amount_widget.cpp:225
DynamicFontSizePushButton * incrementButton
Definition card_amount_widget.h:54
void removePrintingMainboard()
Removes a printing from the mainboard zone.
Definition card_amount_widget.cpp:217
QSlider * cardSizeSlider
Definition card_amount_widget.h:50
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.
Definition card_amount_widget.cpp:17
void deckModified(const QString &modificationReason)
QString zoneName
Definition card_amount_widget.h:52
void addPrinting(const QString &zone)
Adds a printing of the card to the specified zone (Mainboard or Sideboard).
Definition card_amount_widget.cpp:145
DeckListModel * deckModel
Definition card_amount_widget.h:48
ExactCard rootCard
Definition card_amount_widget.h:51
void addPrintingMainboard()
Adds a printing to the mainboard zone.
Definition card_amount_widget.cpp:201
void offsetCountAtIndex(const QModelIndex &idx, int offset)
Offsets the card count at the specified index by the given amount.
Definition card_amount_widget.cpp:249
void addPrintingSideboard()
Adds a printing to the sideboard zone.
Definition card_amount_widget.cpp:209
QTreeView * deckView
Definition card_amount_widget.h:49
void decrementCardHelper(const QString &zoneName)
Helper function to decrement the card count for a given zone.
Definition card_amount_widget.cpp:275
QLabel * cardCountInZone
Definition card_amount_widget.h:56
AbstractTabDeckEditor * deckEditor
Definition card_amount_widget.h:47
Qt model representing a decklist for use in views (tree/table).
Definition deck_list_model.h:200
Definition dynamic_font_size_push_button.h:15
Represents a specific card instance, defined by its CardInfo and a particular printing.
Definition exact_card.h:19