![]() |
Cockatrice 2026-06-01-Development-3.1.0-beta.3
A virtual tabletop for multiplayer card games
|
#include <view_zone.h>
Classes | |
| struct | GridSize |
Public Slots | |
| void | addToViews () |
| void | removeFromViews () |
| void | close () |
| void | setFilterString (const QString &_filterString) |
| void | setGroupBy (CardList::SortOption _groupBy) |
| void | setSortBy (CardList::SortOption _sortBy) |
| void | setPileView (int _pileView) |
| Public Slots inherited from CardZone | |
| bool | showContextMenu (const QPoint &screenPos) |
Signals | |
| void | closed () |
| void | optimumRectChanged () |
| void | wheelEventReceived (QGraphicsSceneWheelEvent *event) |
Public Member Functions | |
| ZoneViewZone (ZoneViewZoneLogic *_logic, QGraphicsItem *parent) | |
| QRectF | boundingRect () const override |
| void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override |
| void | reorganizeCards () override |
| void | initializeCards (const QList< const ServerInfo_Card * > &cardList=QList< const ServerInfo_Card * >()) |
| void | setGeometry (const QRectF &rect) override |
| QRectF | getOptimumRect () const |
| Public Member Functions inherited from SelectZone | |
| SelectZone (CardZoneLogic *logic, QGraphicsItem *parent=nullptr) | |
| ~SelectZone () override | |
| void | onCardAdded (CardItem *addedCard) override |
| Called when a card is added to this zone. Default: reparents card to this item. | |
| void | escapeClipForHover (QGraphicsItem *card) |
| Temporarily reparents a card from the clip container to this zone so hover scaling is visible beyond clip bounds. Safe no-op if no clip container exists. Coordinates are preserved (clip container is at (0,0) with no transform). | |
| void | restoreClipAfterHover (QGraphicsItem *card) |
| Restores a hover-escaped card back to the clip container. Guards against zone transitions that already reparented the card. | |
| Public Member Functions inherited from CardZone | |
| int | type () const override |
| CardZone (CardZoneLogic *logic, QGraphicsItem *parent=nullptr) | |
| void | retranslateUi () |
| CardZoneLogic * | getLogic () const |
| void | setMenu (QMenu *_menu, QAction *_doubleClickAction=0) |
| Public Member Functions inherited from AbstractGraphicsItem | |
| AbstractGraphicsItem (QGraphicsItem *parent=nullptr) | |
Protected Member Functions | |
| QSizeF | sizeHint (Qt::SizeHint which, const QSizeF &constraint=QSizeF()) const override |
| void | wheelEvent (QGraphicsSceneWheelEvent *event) override |
| Protected Member Functions inherited from SelectZone | |
| StackLayoutParams | buildStackParams (qreal minOffset=0.0) const |
| Builds StackLayoutParams from the current card list and zone geometry. | |
| int | calcDropIndexFromY (qreal dropY, qreal minOffset=0.0) const |
| Computes the card index at a given y-coordinate within the zone's vertical layout. Returns 0 if the zone has no cards or the offset is zero. | |
| void | layoutCardsVertically (const StackLayoutParams ¶ms) |
| Positions cards vertically with alternating left/right x-offsets. | |
| void | restoreStaleEscapedCards () |
| Restores any cards that were hover-escaped but whose hover state was not properly cleaned up. Call at the start of reorganizeCards() in zones that use a clip container. | |
| void | setupClipContainer (std::optional< qreal > zValue=std::nullopt) |
| Creates a clip container child item that clips card overflow to zone bounds. Cards entering this zone are reparented to this container by the onCardAdded override. Disables zone-level child clipping; clipping is delegated to the container. | |
| void | updateClipRect () |
| Updates the clip container rect to match this zone's current boundingRect(). | |
| 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 QPointF | closestGridPoint (const QPointF &point) |
| QMenu * | getMenu () const |
| Protected Member Functions inherited from AbstractGraphicsItem | |
| void | paintNumberEllipse (int number, int radius, const QColor &color, int position, int count, QPainter *painter) |
Private Slots | |
| void | zoneDumpReceived (const Response &r) |
Private Member Functions | |
| GridSize | positionCardsForDisplay (CardList &cards, CardList::SortOption pileOption=CardList::NoSort) |
| Sets the position of each card to the proper position for the view. | |
| void | handleDropEvent (const QList< CardDragItem * > &dragItems, CardZoneLogic *startZone, const QPoint &dropPoint) override |
Private Attributes | |
| QRectF | bRect |
| QRectF | optimumRect |
| int | minRows |
| FilterString | filterString = FilterString("") |
| CardList::SortOption | groupBy |
| CardList::SortOption | sortBy |
| bool | pileView |
Static Private Attributes | |
| static constexpr int | HORIZONTAL_PADDING = 12 |
| static constexpr int | VERTICAL_PADDING = 5 |
Additional Inherited Members | |
| Public Types inherited from CardZone | |
| enum | { Type = typeZone } |
| Static Public Member Functions inherited from SelectZone | |
| static SelectZone * | findOwningSelectZone (const QGraphicsItem *card) |
| Finds the SelectZone that owns a card, regardless of whether the card is parented to the zone directly or to its clip container. Returns nullptr if not in a SelectZone. | |
| Static Protected Member Functions inherited from SelectZone | |
| static ZoneLayout | computeZoneLayout (const StackLayoutParams ¶ms) |
| Computes layout for a vertical card stack (effective offset and start position). | |
| Protected Attributes inherited from CardZone | |
| QMenu * | menu |
| QAction * | doubleClickAction |
| Static Protected Attributes inherited from SelectZone | |
| static constexpr qreal | MIN_CARD_VISIBLE = 10.0 |
| Minimum visible pixels of each card's top edge when stacking compresses offsets in tight zones. | |
A CardZone that is a view into another CardZone. If this zone is writable, then modifications to this zone will be reflected in the underlying zone.
Most interactions with StackZones are handled through a zone view. For example, viewing the deck/graveyard/exile is handled through a view.
Handles both limited reveals (eg. look at top X cards) and full zone reveals (eg. searching the deck).
| ZoneViewZone::ZoneViewZone | ( | ZoneViewZoneLogic * | _logic, |
| QGraphicsItem * | parent ) |
| parent | the parent QGraphicsWidget containing the reveal zone |
|
slot |
|
nodiscardoverride |
|
slot |
Deletes this ZoneView and removes it from the origZone's views. You should normally call this method instead of deleteLater()
|
signal |
|
inlinenodiscard |
|
overrideprivatevirtual |
| void ZoneViewZone::initializeCards | ( | const QList< const ServerInfo_Card * > & | cardList = QList<const ServerInfo_Card *>() | ) |
|
signal |
|
override |
|
private |
Sets the position of each card to the proper position for the view.
| cards | The cards to reposition. Will modify the cards in the list. |
| pileOption | Property used to group cards for the piles. Expects cards to be sorted by that property. Pass in NoSort to not make piles. |
|
slot |
|
overridevirtual |
Implements CardZone.
|
slot |
|
override |
|
slot |
|
slot |
|
slot |
|
nodiscardoverrideprotected |
|
overrideprotected |
|
signal |
|
privateslot |
|
private |
|
private |
|
private |
|
staticconstexprprivate |
|
private |
|
private |
|
private |
|
private |
|
staticconstexprprivate |