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

Interactive crop surface showing how a playmat card art will appear across the combined table + stack play area. More...

#include <playmat_preview_widget.h>

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

Signals

void paramsEdited (const PlaymatParams &params)
 Emitted whenever direct manipulation (drag, wheel, keys) changes the crop parameters.

Public Member Functions

 PlaymatPreviewWidget (QWidget *parent=nullptr)
void setPixmap (const QPixmap &pixmap)
void setParams (const PlaymatParams &params)
void setAttribution (const QString &attribution)

Protected Member Functions

void paintEvent (QPaintEvent *event) override
void mousePressEvent (QMouseEvent *event) override
void mouseMoveEvent (QMouseEvent *event) override
void mouseReleaseEvent (QMouseEvent *event) override
void wheelEvent (QWheelEvent *event) override
void keyPressEvent (QKeyEvent *event) override
void focusInEvent (QFocusEvent *event) override

Private Member Functions

QRectF activePlayArea () const
 destination rect used for rendering AND gesture math
qreal samplingWindowSide () const
 clamped square window side, shared with the render path
qreal widgetToSourceScale () const
void applyCropDelta (qreal dMarginL, qreal dMarginR, qreal dOffset, qreal zoomFactor)
bool sameCrop (const PlaymatParams &a, const PlaymatParams &b) const
void restoreSnapshot ()

Private Attributes

QPixmap sourcePixmap
PlaymatParams params
PlaymatParams paramsAtFocusIn
 crop as of the latest focus gain, restored by Esc or Backspace
QString attributionText
QPoint lastDragPos
 widget space position of the previous mouse move while panning

Detailed Description

Interactive crop surface showing how a playmat card art will appear across the combined table + stack play area.

Renders a fixed frame shaped like a fresh board's stack+table area (the most generous framing the game produces): it shows the tallest slice of the square crop in normal play, with dimmed strips marking where a wider, developed table crops further, exactly the game's own render pipeline. The widget doubles as the editor's primary crop control: dragging pans the art behind the frame, the wheel zooms, and arrow keys nudge, mirroring the stored parameters (margins pan horizontally, verticalOffset vertically, zoom scales) so no separate numeric controls are needed.

Constructor & Destructor Documentation

◆ PlaymatPreviewWidget()

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

Member Function Documentation

◆ activePlayArea()

QRectF PlaymatPreviewWidget::activePlayArea ( ) const
private

destination rect used for rendering AND gesture math

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

◆ applyCropDelta()

void PlaymatPreviewWidget::applyCropDelta ( qreal dMarginL,
qreal dMarginR,
qreal dOffset,
qreal zoomFactor )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ focusInEvent()

void PlaymatPreviewWidget::focusInEvent ( QFocusEvent * event)
overrideprotected

◆ keyPressEvent()

void PlaymatPreviewWidget::keyPressEvent ( QKeyEvent * event)
overrideprotected
Here is the call graph for this function:

◆ mouseMoveEvent()

void PlaymatPreviewWidget::mouseMoveEvent ( QMouseEvent * event)
overrideprotected
Here is the call graph for this function:

◆ mousePressEvent()

void PlaymatPreviewWidget::mousePressEvent ( QMouseEvent * event)
overrideprotected
Here is the call graph for this function:

◆ mouseReleaseEvent()

void PlaymatPreviewWidget::mouseReleaseEvent ( QMouseEvent * event)
overrideprotected

◆ paintEvent()

void PlaymatPreviewWidget::paintEvent ( QPaintEvent * event)
overrideprotected
Here is the call graph for this function:

◆ paramsEdited

void PlaymatPreviewWidget::paramsEdited ( const PlaymatParams & params)
signal

Emitted whenever direct manipulation (drag, wheel, keys) changes the crop parameters.

Here is the caller graph for this function:

◆ restoreSnapshot()

void PlaymatPreviewWidget::restoreSnapshot ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sameCrop()

bool PlaymatPreviewWidget::sameCrop ( const PlaymatParams & a,
const PlaymatParams & b ) const
private
Here is the caller graph for this function:

◆ samplingWindowSide()

qreal PlaymatPreviewWidget::samplingWindowSide ( ) const
private

clamped square window side, shared with the render path

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

◆ setAttribution()

void PlaymatPreviewWidget::setAttribution ( const QString & attribution)

◆ setParams()

void PlaymatPreviewWidget::setParams ( const PlaymatParams & params)

◆ setPixmap()

void PlaymatPreviewWidget::setPixmap ( const QPixmap & pixmap)

◆ wheelEvent()

void PlaymatPreviewWidget::wheelEvent ( QWheelEvent * event)
overrideprotected
Here is the call graph for this function:

◆ widgetToSourceScale()

qreal PlaymatPreviewWidget::widgetToSourceScale ( ) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ attributionText

QString PlaymatPreviewWidget::attributionText
private

◆ lastDragPos

QPoint PlaymatPreviewWidget::lastDragPos
private

widget space position of the previous mouse move while panning

◆ params

PlaymatParams PlaymatPreviewWidget::params
private

◆ paramsAtFocusIn

PlaymatParams PlaymatPreviewWidget::paramsAtFocusIn
private

crop as of the latest focus gain, restored by Esc or Backspace

◆ sourcePixmap

QPixmap PlaymatPreviewWidget::sourcePixmap
private

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