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

#include <table_zone.h>

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

Public Slots

void reorganizeCards () override
Public Slots inherited from CardZone
bool showContextMenu (const QPoint &screenPos)
void onCardAdded (CardItem *addedCard)

Signals

void sizeChanged ()

Public Member Functions

 TableZone (TableZoneLogic *_logic, QGraphicsItem *parent=nullptr)
QRectF boundingRect () const override
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
void toggleTapped ()
void handleDropEvent (const QList< CardDragItem * > &dragItems, CardZoneLogic *startZone, const QPoint &dropPoint) override
void handleDropEventByGrid (const QList< CardDragItem * > &dragItems, CardZoneLogic *startZone, const QPoint &gridPoint)
CardItemgetCardFromGrid (const QPoint &gridPoint) const
CardItemgetCardFromCoords (const QPointF &point) const
QPointF closestGridPoint (const QPointF &point) override
void resizeToContents ()
int getMinimumWidth () const
void setWidth (qreal _width)
qreal getWidth () const
void setActive (bool _active)
Public Member Functions inherited from SelectZone
 SelectZone (CardZoneLogic *logic, QGraphicsItem *parent=nullptr)
Public Member Functions inherited from CardZone
int type () const override
 CardZone (CardZoneLogic *logic, QGraphicsItem *parent=nullptr)
void retranslateUi ()
CardZoneLogicgetLogic () const
void setMenu (QMenu *_menu, QAction *_doubleClickAction=0)
Public Member Functions inherited from AbstractGraphicsItem
 AbstractGraphicsItem (QGraphicsItem *parent=nullptr)

Static Public Member Functions

static int clampValidTableRow (const int row)

Private Slots

void updateBg ()

Private Member Functions

bool isInverted () const
void paintZoneOutline (QPainter *painter)
void paintLandDivider (QPainter *painter)
void computeCardStackWidths ()
QPointF mapFromGrid (QPoint gridPoint) const
QPoint mapToGrid (const QPointF &mapPoint) const
int getCardStackMapKey (int x, int y) const

Private Attributes

int width
int height
int currentMinimumWidth
QMap< int, int > cardStackWidth
QPixmap backgroundPixelMap
bool active = false

Static Private Attributes

static const int TABLEROWS = 3
static const int MARGIN_LEFT = 20
static const int MARGIN_RIGHT = 15
static const int MARGIN_TOP = 10
static const int MARGIN_BOTTOM = 30
static const int PADDING_X = 35
static const int PADDING_Y = 30
static const int MIN_WIDTH = MARGIN_LEFT + (5 * CARD_WIDTH) + MARGIN_RIGHT
static const int STACKED_CARD_OFFSET_X = CARD_WIDTH / 3
static const int STACKED_CARD_OFFSET_Y = PADDING_Y / 3
static const int BOX_LINE_WIDTH = 10
static const QColor BACKGROUND_COLOR = QColor(100, 100, 100)
static const QColor FADE_MASK = QColor(0, 0, 0, 80)
static const QColor GRADIENT_COLOR = QColor(255, 255, 255, 150)
static const QColor GRADIENT_COLORLESS = QColor(255, 255, 255, 0)

Additional Inherited Members

Public Types inherited from CardZone
enum  { Type = typeZone }
Protected Member Functions inherited from SelectZone
void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override
void mousePressEvent (QGraphicsSceneMouseEvent *event) override
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override
Protected Member Functions inherited from CardZone
void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override
void mousePressEvent (QGraphicsSceneMouseEvent *event) override
virtual void reorganizeCards ()=0
QMenu * getMenu () const
Protected Member Functions inherited from AbstractGraphicsItem
void paintNumberEllipse (int number, int radius, const QColor &color, int position, int count, QPainter *painter)
Protected Attributes inherited from CardZone
QMenu * menu
QAction * doubleClickAction

Constructor & Destructor Documentation

◆ TableZone()

TableZone::TableZone ( TableZoneLogic * _logic,
QGraphicsItem * parent = nullptr )
explicit

Constructs TableZone.

Parameters
_pthe Player
parentdefaults to null
Here is the call graph for this function:

Member Function Documentation

◆ boundingRect()

QRectF TableZone::boundingRect ( ) const
nodiscardoverride
Returns
a QRectF of the TableZone bounding box.
Here is the caller graph for this function:

◆ clampValidTableRow()

int TableZone::clampValidTableRow ( const int row)
static
Here is the caller graph for this function:

◆ closestGridPoint()

QPointF TableZone::closestGridPoint ( const QPointF & point)
overridevirtual

Reimplemented from CardZone.

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

◆ computeCardStackWidths()

void TableZone::computeCardStackWidths ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCardFromCoords()

CardItem * TableZone::getCardFromCoords ( const QPointF & point) const
nodiscard
Returns
CardItem from coordinate location
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCardFromGrid()

CardItem * TableZone::getCardFromGrid ( const QPoint & gridPoint) const
nodiscard
Returns
CardItem from grid location
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCardStackMapKey()

int TableZone::getCardStackMapKey ( int x,
int y ) const
inlinenodiscardprivate
Here is the caller graph for this function:

◆ getMinimumWidth()

int TableZone::getMinimumWidth ( ) const
inlinenodiscard

◆ getWidth()

qreal TableZone::getWidth ( ) const
inlinenodiscard

◆ handleDropEvent()

void TableZone::handleDropEvent ( const QList< CardDragItem * > & dragItems,
CardZoneLogic * startZone,
const QPoint & dropPoint )
overridevirtual

See HandleDropEventByGrid

Implements CardZone.

Here is the call graph for this function:

◆ handleDropEventByGrid()

void TableZone::handleDropEventByGrid ( const QList< CardDragItem * > & dragItems,
CardZoneLogic * startZone,
const QPoint & gridPoint )

Handles the placement of cards

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

◆ isInverted()

bool TableZone::isInverted ( ) const
nodiscardprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mapFromGrid()

QPointF TableZone::mapFromGrid ( QPoint gridPoint) const
nodiscardprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mapToGrid()

QPoint TableZone::mapToGrid ( const QPointF & mapPoint) const
nodiscardprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ paint()

void TableZone::paint ( QPainter * painter,
const QStyleOptionGraphicsItem * option,
QWidget * widget )
override

Render the TableZone

Parameters
painter
option
Here is the call graph for this function:

◆ paintLandDivider()

void TableZone::paintLandDivider ( QPainter * painter)
private

Render a division line for land placement

@painter QPainter object

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

◆ paintZoneOutline()

void TableZone::paintZoneOutline ( QPainter * painter)
private

Render a soft outline around the edge of the TableZone.

Parameters
painterQPainter object
Here is the caller graph for this function:

◆ reorganizeCards

void TableZone::reorganizeCards ( )
overrideslot

Reorganizes CardItems in the TableZone

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

◆ resizeToContents()

void TableZone::resizeToContents ( )

Resizes the TableZone in case CardItems are within or outside of the TableZone constraints.

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

◆ setActive()

void TableZone::setActive ( bool _active)
inline

◆ setWidth()

void TableZone::setWidth ( qreal _width)
inline

◆ sizeChanged

void TableZone::sizeChanged ( )
signal
Here is the caller graph for this function:

◆ toggleTapped()

void TableZone::toggleTapped ( )

Toggles the selected items as tapped.

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

◆ updateBg

void TableZone::updateBg ( )
privateslot

Loads in any found custom background and updates

Here is the caller graph for this function:

Member Data Documentation

◆ active

bool TableZone::active = false
private

◆ BACKGROUND_COLOR

const QColor TableZone::BACKGROUND_COLOR = QColor(100, 100, 100)
staticprivate

◆ backgroundPixelMap

QPixmap TableZone::backgroundPixelMap
private

◆ BOX_LINE_WIDTH

const int TableZone::BOX_LINE_WIDTH = 10
staticprivate

◆ cardStackWidth

QMap<int, int> TableZone::cardStackWidth
private

◆ currentMinimumWidth

int TableZone::currentMinimumWidth
private

◆ FADE_MASK

const QColor TableZone::FADE_MASK = QColor(0, 0, 0, 80)
staticprivate

◆ GRADIENT_COLOR

const QColor TableZone::GRADIENT_COLOR = QColor(255, 255, 255, 150)
staticprivate

◆ GRADIENT_COLORLESS

const QColor TableZone::GRADIENT_COLORLESS = QColor(255, 255, 255, 0)
staticprivate

◆ height

int TableZone::height
private

◆ MARGIN_BOTTOM

const int TableZone::MARGIN_BOTTOM = 30
staticprivate

◆ MARGIN_LEFT

const int TableZone::MARGIN_LEFT = 20
staticprivate

◆ MARGIN_RIGHT

const int TableZone::MARGIN_RIGHT = 15
staticprivate

◆ MARGIN_TOP

const int TableZone::MARGIN_TOP = 10
staticprivate

◆ MIN_WIDTH

const int TableZone::MIN_WIDTH = MARGIN_LEFT + (5 * CARD_WIDTH) + MARGIN_RIGHT
staticprivate

◆ PADDING_X

const int TableZone::PADDING_X = 35
staticprivate

◆ PADDING_Y

const int TableZone::PADDING_Y = 30
staticprivate

◆ STACKED_CARD_OFFSET_X

const int TableZone::STACKED_CARD_OFFSET_X = CARD_WIDTH / 3
staticprivate

◆ STACKED_CARD_OFFSET_Y

const int TableZone::STACKED_CARD_OFFSET_Y = PADDING_Y / 3
staticprivate

◆ TABLEROWS

const int TableZone::TABLEROWS = 3
staticprivate

◆ width

int TableZone::width
private

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