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

#include <printing_selector_card_overlay_widget.h>

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

Signals

void cardPreferenceChanged ()

Public Member Functions

 PrintingSelectorCardOverlayWidget (QWidget *parent, AbstractTabDeckEditor *_deckEditor, DeckListModel *_deckModel, QTreeView *_deckView, QSlider *_cardSizeSlider, const ExactCard &_rootCard)
 Constructs a PrintingSelectorCardOverlayWidget for displaying a card overlay.

Protected Member Functions

void resizeEvent (QResizeEvent *event) override
 Resizes the overlay widget to match the card's size.
void enterEvent (QEnterEvent *event) override
 Handles the mouse enter event when the cursor enters the overlay widget area.
void leaveEvent (QEvent *event) override
 Handles the mouse leave event when the cursor leaves the overlay widget area.
void mousePressEvent (QMouseEvent *event) override
 Handles the mouse press event for right-clicks to show the context menu.
void customMenu (QPoint point)
 Creates and shows a custom context menu when the right mouse button is clicked.

Private Slots

void updatePinBadgeVisibility ()
 Updates the pin badge visibility and position based on the card's pinned state.

Private Member Functions

void initializePinBadge ()
 Initializes the pin badge overlay and loads its icon with DPI-aware rasterization.

Private Attributes

CardInfoPictureWidgetcardInfoPicture
AllZonesCardAmountWidgetallZonesCardAmountWidget
QLabel * pinBadge = nullptr
AbstractTabDeckEditordeckEditor
DeckListModeldeckModel
QTreeView * deckView
QSlider * cardSizeSlider
ExactCard rootCard

Constructor & Destructor Documentation

◆ PrintingSelectorCardOverlayWidget()

PrintingSelectorCardOverlayWidget::PrintingSelectorCardOverlayWidget ( QWidget * parent,
AbstractTabDeckEditor * _deckEditor,
DeckListModel * _deckModel,
QTreeView * _deckView,
QSlider * _cardSizeSlider,
const ExactCard & _rootCard )
explicit

Constructs a PrintingSelectorCardOverlayWidget for displaying a card overlay.

This widget is responsible for showing the card's image and providing interactive features such as a context menu and the ability to adjust the card's scale. It includes the card's image as well as a widget that displays the card amounts in different zones (mainboard, sideboard, etc.).

Parameters
parentThe parent widget for this overlay.
_deckEditorThe TabDeckEditor instance for deck management.
_deckModelThe DeckListModel instance providing deck data.
_deckViewThe QTreeView instance displaying the deck.
_cardSizeSliderThe slider controlling the size of the card.
_rootCardThe root card object that contains information about the card.
Here is the call graph for this function:

Member Function Documentation

◆ cardPreferenceChanged

void PrintingSelectorCardOverlayWidget::cardPreferenceChanged ( )
signal
Here is the caller graph for this function:

◆ customMenu()

void PrintingSelectorCardOverlayWidget::customMenu ( QPoint point)
protected

Creates and shows a custom context menu when the right mouse button is clicked.

The context menu includes an option to show related cards, which displays a submenu with actions for each related card. When an action is triggered, the card information is updated, and the printing selector is shown.

Parameters
pointThe position of the mouse when the right-click occurred.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ enterEvent()

void PrintingSelectorCardOverlayWidget::enterEvent ( QEnterEvent * event)
overrideprotected

Handles the mouse enter event when the cursor enters the overlay widget area.

When the cursor enters the widget, the card information is updated, and the card amount widget is displayed if the amounts are zero for both the mainboard and sideboard.

Parameters
eventThe event triggered when the mouse enters the widget.

◆ initializePinBadge()

void PrintingSelectorCardOverlayWidget::initializePinBadge ( )
private

Initializes the pin badge overlay and loads its icon with DPI-aware rasterization.

The icon is rasterized once using the label's device pixel ratio so it stays crisp on HiDPI displays. The resulting pixmap is cached on the QLabel and simply shown/hidden when needed. If the SVG cannot be read, a textual fallback badge is created instead.

Here is the caller graph for this function:

◆ leaveEvent()

void PrintingSelectorCardOverlayWidget::leaveEvent ( QEvent * event)
overrideprotected

Handles the mouse leave event when the cursor leaves the overlay widget area.

When the cursor leaves the widget, the card amount widget is hidden if both the mainboard and sideboard amounts are zero.

Parameters
eventThe event triggered when the mouse leaves the widget.

◆ mousePressEvent()

void PrintingSelectorCardOverlayWidget::mousePressEvent ( QMouseEvent * event)
overrideprotected

Handles the mouse press event for right-clicks to show the context menu.

If the right mouse button is pressed, a custom context menu will appear. For other mouse buttons, the event is passed to the base class for default handling.

Parameters
eventThe mouse event triggered by the user.
Here is the call graph for this function:

◆ resizeEvent()

void PrintingSelectorCardOverlayWidget::resizeEvent ( QResizeEvent * event)
overrideprotected

Resizes the overlay widget to match the card's size.

This method ensures that the amount widget matches the card's size when the overlay widget is resized. It also resizes the card info picture widget to match the new size.

Parameters
eventThe resize event triggered when the widget is resized.

◆ updatePinBadgeVisibility

void PrintingSelectorCardOverlayWidget::updatePinBadgeVisibility ( )
privateslot

Updates the pin badge visibility and position based on the card's pinned state.

This method checks whether the current card printing is pinned and updates the pin badge accordingly. If the card is pinned, the badge is made visible and positioned in the top-right corner of the card image with appropriate margins. If the card is not pinned, the badge is hidden.

The method is called whenever the card preference changes or the card size is adjusted via the slider to ensure the badge remains properly positioned.

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

Member Data Documentation

◆ allZonesCardAmountWidget

AllZonesCardAmountWidget* PrintingSelectorCardOverlayWidget::allZonesCardAmountWidget
private

◆ cardInfoPicture

CardInfoPictureWidget* PrintingSelectorCardOverlayWidget::cardInfoPicture
private

◆ cardSizeSlider

QSlider* PrintingSelectorCardOverlayWidget::cardSizeSlider
private

◆ deckEditor

AbstractTabDeckEditor* PrintingSelectorCardOverlayWidget::deckEditor
private

◆ deckModel

DeckListModel* PrintingSelectorCardOverlayWidget::deckModel
private

◆ deckView

QTreeView* PrintingSelectorCardOverlayWidget::deckView
private

◆ pinBadge

QLabel* PrintingSelectorCardOverlayWidget::pinBadge = nullptr
private

◆ rootCard

ExactCard PrintingSelectorCardOverlayWidget::rootCard
private

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