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

#include <deck_preview_widget.h>

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

Public Slots

void syncFromModel ()
 Re-reads the row's data from the model and syncs every child widget. Connected to the model's dataChanged signal.
void reloadIfModified ()
 Reloads the deck file if its modification time is newer than the stored one.
void refreshBannerCardToolTip ()
void updateColorIdentityVisibility (bool visible)
void updateBannerCardComboBoxVisibility (bool visible)
void updateTagsVisibility (bool visible)
void setBannerCard (int)
void setTags (const QStringList &tags)

Signals

void deckLoadRequested (const QString &filePath)
void openDeckEditor (const LoadedDeck &deck)

Public Member Functions

 DeckPreviewWidget (QWidget *parent, VisualDeckStorageWidget *_visualDeckStorageWidget, VisualDeckStorageModel *_model, const QString &_filePath)
void retranslateUi ()

Public Attributes

DeckPreviewCardPictureWidgetbannerCardDisplayWidget
 The banner card picture; the parent widget wires its size to the card size setting.

Protected Member Functions

void enterEvent (QEnterEvent *event) override
void resizeEvent (QResizeEvent *event) override

Private Member Functions

int row () const
 The row of this deck in the source model, or -1 if it no longer exists.
QString getDisplayName () const
 The display name is given by the deck name, or the filename if the deck name is not set.
void refreshBannerCardText ()
void updateBannerCardComboBox (const QString &currentText)
bool promptFileConversionIfRequired ()
QMenu * createRightClickMenu ()
void addSetBannerCardMenu (QMenu *menu)
void imageClickedEvent (QMouseEvent *event, DeckPreviewCardPictureWidget *instance)
void imageDoubleClickedEvent (QMouseEvent *event, DeckPreviewCardPictureWidget *instance)
void actRenameDeck ()
void actRenameFile ()
void actDeleteFile ()

Private Attributes

VisualDeckStorageWidgetvisualDeckStorageWidget
VisualDeckStorageModelmodel
QString filePath
QVBoxLayout * layout
ColorIdentityWidgetcolorIdentityWidget
DeckPreviewDeckTagsDisplayWidgetdeckTagsDisplayWidget
QLabel * bannerCardLabel
QComboBox * bannerCardComboBox
QList< QWidget * > fixedWidthChildren
 Children clamped to the picture width on resize.
int lastKnownBannerWidth = -1
 The picture width last applied to the children.

Constructor & Destructor Documentation

◆ DeckPreviewWidget()

DeckPreviewWidget::DeckPreviewWidget ( QWidget * parent,
VisualDeckStorageWidget * _visualDeckStorageWidget,
VisualDeckStorageModel * _model,
const QString & _filePath )
explicit
Here is the call graph for this function:

Member Function Documentation

◆ actDeleteFile()

void DeckPreviewWidget::actDeleteFile ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ actRenameDeck()

void DeckPreviewWidget::actRenameDeck ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ actRenameFile()

void DeckPreviewWidget::actRenameFile ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addSetBannerCardMenu()

void DeckPreviewWidget::addSetBannerCardMenu ( QMenu * menu)
private

Adds the "Set Banner Card" submenu to the given menu. Does nothing if bannerCardComboBox is null.

Parameters
menuThe menu to add the submenu to
Here is the caller graph for this function:

◆ createRightClickMenu()

QMenu * DeckPreviewWidget::createRightClickMenu ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deckLoadRequested

void DeckPreviewWidget::deckLoadRequested ( const QString & filePath)
signal
Here is the caller graph for this function:

◆ enterEvent()

void DeckPreviewWidget::enterEvent ( QEnterEvent * event)
overrideprotected
Here is the call graph for this function:

◆ getDisplayName()

QString DeckPreviewWidget::getDisplayName ( ) const
nodiscardprivate

The display name is given by the deck name, or the filename if the deck name is not set.

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

◆ imageClickedEvent()

void DeckPreviewWidget::imageClickedEvent ( QMouseEvent * event,
DeckPreviewCardPictureWidget * instance )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ imageDoubleClickedEvent()

void DeckPreviewWidget::imageDoubleClickedEvent ( QMouseEvent * event,
DeckPreviewCardPictureWidget * instance )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ openDeckEditor

void DeckPreviewWidget::openDeckEditor ( const LoadedDeck & deck)
signal
Here is the caller graph for this function:

◆ promptFileConversionIfRequired()

bool DeckPreviewWidget::promptFileConversionIfRequired ( )
private

Checks if the deck's file format supports tags. If not, then prompt the user for file conversion.

Returns
whether the resulting file can support adding tags
Here is the call graph for this function:
Here is the caller graph for this function:

◆ refreshBannerCardText()

void DeckPreviewWidget::refreshBannerCardText ( )
private

Refreshes the banner card text. This also calls refreshBannerCardToolTip, since those two often need to be updated together.

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

◆ refreshBannerCardToolTip

void DeckPreviewWidget::refreshBannerCardToolTip ( )
slot
Here is the caller graph for this function:

◆ reloadIfModified

void DeckPreviewWidget::reloadIfModified ( )
slot

Reloads the deck file if its modification time is newer than the stored one.

Reloads the deck if the file's last modified time has increased since we last checked.

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

◆ resizeEvent()

void DeckPreviewWidget::resizeEvent ( QResizeEvent * event)
overrideprotected

◆ retranslateUi()

void DeckPreviewWidget::retranslateUi ( )
Here is the caller graph for this function:

◆ row()

int DeckPreviewWidget::row ( ) const
nodiscardprivate

The row of this deck in the source model, or -1 if it no longer exists.

Here is the caller graph for this function:

◆ setBannerCard

void DeckPreviewWidget::setBannerCard ( int )
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTags

void DeckPreviewWidget::setTags ( const QStringList & tags)
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ syncFromModel

void DeckPreviewWidget::syncFromModel ( )
slot

Re-reads the row's data from the model and syncs every child widget. Connected to the model's dataChanged signal.

Syncs the contents of the child widgets with the current row's data.

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

◆ updateBannerCardComboBox()

void DeckPreviewWidget::updateBannerCardComboBox ( const QString & currentText)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateBannerCardComboBoxVisibility

void DeckPreviewWidget::updateBannerCardComboBoxVisibility ( bool visible)
slot
Here is the caller graph for this function:

◆ updateColorIdentityVisibility

void DeckPreviewWidget::updateColorIdentityVisibility ( bool visible)
slot
Here is the caller graph for this function:

◆ updateTagsVisibility

void DeckPreviewWidget::updateTagsVisibility ( bool visible)
slot
Here is the caller graph for this function:

Member Data Documentation

◆ bannerCardComboBox

QComboBox* DeckPreviewWidget::bannerCardComboBox
private

◆ bannerCardDisplayWidget

DeckPreviewCardPictureWidget* DeckPreviewWidget::bannerCardDisplayWidget

The banner card picture; the parent widget wires its size to the card size setting.

◆ bannerCardLabel

QLabel* DeckPreviewWidget::bannerCardLabel
private

◆ colorIdentityWidget

ColorIdentityWidget* DeckPreviewWidget::colorIdentityWidget
private

◆ deckTagsDisplayWidget

DeckPreviewDeckTagsDisplayWidget* DeckPreviewWidget::deckTagsDisplayWidget
private

◆ filePath

QString DeckPreviewWidget::filePath
private

◆ fixedWidthChildren

QList<QWidget *> DeckPreviewWidget::fixedWidthChildren
private

Children clamped to the picture width on resize.

◆ lastKnownBannerWidth

int DeckPreviewWidget::lastKnownBannerWidth = -1
private

The picture width last applied to the children.

◆ layout

QVBoxLayout* DeckPreviewWidget::layout
private

◆ model

VisualDeckStorageModel* DeckPreviewWidget::model
private

◆ visualDeckStorageWidget

VisualDeckStorageWidget* DeckPreviewWidget::visualDeckStorageWidget
private

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