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

Widget for displaying a deck preview image with overlaid metadata labels. More...

#include <archidekt_deck_preview_image_display_widget.h>

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

Public Member Functions

 ArchidektDeckPreviewImageDisplayWidget (QWidget *parent=nullptr)
 Constructs the deck preview display widget.
void setAspectRatio (float ratio)
 Sets the aspect ratio for the preview image (height / width).
void setPreviewWidth (int width)
 Sets the width of the preview image; height is adjusted according to the aspect ratio.

Public Attributes

QLabel * imageLabel
 QLabel to display the deck image.
ShadowBackgroundLabeltopLeftLabel
 Overlay label at top-left (deck name)
ShadowBackgroundLabeltopRightLabel
 Overlay label at top-right (card count)
ShadowBackgroundLabelbottomLeftLabel
 Overlay label at bottom-left (EDH bracket)
ShadowBackgroundLabelbottomRightLabel
 Overlay label at bottom-right (views)

Protected Member Functions

void resizeEvent (QResizeEvent *event) override
 Handles resize events to reposition the image and overlay labels.

Private Attributes

float aspectRatio = 1.0f
 Aspect ratio to maintain for the preview image.

Detailed Description

Widget for displaying a deck preview image with overlaid metadata labels.

This widget shows a deck's preview image along with several overlay labels:

  • Top-left: Deck name.
  • Top-right: Card count.
  • Bottom-left: EDH bracket (if applicable).
  • Bottom-right: View count.

Labels automatically scale and position themselves relative to the widget's size. The image can be scaled while maintaining a specified aspect ratio.

Features

  • Adjustable preview width and aspect ratio.
  • Labels automatically repositioned on resize.
  • Supports overlaying multiple pieces of metadata with shadowed labels for readability.

Constructor & Destructor Documentation

◆ ArchidektDeckPreviewImageDisplayWidget()

ArchidektDeckPreviewImageDisplayWidget::ArchidektDeckPreviewImageDisplayWidget ( QWidget * parent = nullptr)
explicit

Constructs the deck preview display widget.

Parameters
parentOptional parent widget.

Member Function Documentation

◆ resizeEvent()

void ArchidektDeckPreviewImageDisplayWidget::resizeEvent ( QResizeEvent * event)
overrideprotected

Handles resize events to reposition the image and overlay labels.

Parameters
eventResize event.

◆ setAspectRatio()

void ArchidektDeckPreviewImageDisplayWidget::setAspectRatio ( float ratio)

Sets the aspect ratio for the preview image (height / width).

Parameters
ratioAspect ratio to maintain.

◆ setPreviewWidth()

void ArchidektDeckPreviewImageDisplayWidget::setPreviewWidth ( int width)

Sets the width of the preview image; height is adjusted according to the aspect ratio.

Parameters
widthDesired width in pixels.

Member Data Documentation

◆ aspectRatio

float ArchidektDeckPreviewImageDisplayWidget::aspectRatio = 1.0f
private

Aspect ratio to maintain for the preview image.

◆ bottomLeftLabel

ShadowBackgroundLabel* ArchidektDeckPreviewImageDisplayWidget::bottomLeftLabel

Overlay label at bottom-left (EDH bracket)

◆ bottomRightLabel

ShadowBackgroundLabel* ArchidektDeckPreviewImageDisplayWidget::bottomRightLabel

Overlay label at bottom-right (views)

◆ imageLabel

QLabel* ArchidektDeckPreviewImageDisplayWidget::imageLabel

QLabel to display the deck image.

◆ topLeftLabel

ShadowBackgroundLabel* ArchidektDeckPreviewImageDisplayWidget::topLeftLabel

Overlay label at top-left (deck name)

◆ topRightLabel

ShadowBackgroundLabel* ArchidektDeckPreviewImageDisplayWidget::topRightLabel

Overlay label at top-right (card count)


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