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

#include <card_item.h>

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

Public Types

enum  { Type = typeCard }
Public Types inherited from AbstractCardItem
enum  { Type = typeCard }

Public Slots

void deleteLater ()
Public Slots inherited from AbstractCardItem
void refreshCardInfo ()

Public Member Functions

int type () const override
 CardItem (Player *_owner, QGraphicsItem *parent=nullptr, const CardRef &cardRef={}, int _cardid=-1, CardZoneLogic *_zone=nullptr)
void retranslateUi ()
CardZoneLogicgetZone () const
void setZone (CardZoneLogic *_zone)
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
QPoint getGridPoint () const
void setGridPoint (const QPoint &_gridPoint)
QPoint getGridPos () const
PlayergetOwner () const
void setOwner (Player *_owner)
bool getAttacking () const
void setAttacking (bool _attacking)
const QMap< int, int > & getCounters () const
void setCounter (int _id, int _value)
QString getAnnotation () const
void setAnnotation (const QString &_annotation)
bool getDoesntUntap () const
void setDoesntUntap (bool _doesntUntap)
QString getPT () const
void setPT (const QString &_pt)
bool getDestroyOnZoneChange () const
void setDestroyOnZoneChange (bool _destroy)
CardItemgetAttachedTo () const
void setAttachedTo (CardItem *_attachedTo)
void addAttachedCard (CardItem *card)
void removeAttachedCard (CardItem *card)
const QList< CardItem * > & getAttachedCards () const
void resetState (bool keepAnnotations=false)
void processCardInfo (const ServerInfo_Card &_info)
bool animationEvent ()
CardDragItemcreateDragItem (int _id, const QPointF &_pos, const QPointF &_scenePos, bool faceDown)
void deleteDragItem ()
void drawArrow (const QColor &arrowColor)
void drawAttachArrow ()
void playCard (bool faceDown)
Public Member Functions inherited from AbstractCardItem
int type () const override
 AbstractCardItem (QGraphicsItem *parent=nullptr, const CardRef &cardRef={}, Player *_owner=nullptr, int _id=-1)
 ~AbstractCardItem () override
QRectF boundingRect () const override
QPainterPath shape () const override
QSizeF getTranslatedSize (QPainter *painter) const
void paintPicture (QPainter *painter, const QSizeF &translatedSize, int angle)
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
ExactCard getCard () const
const CardInfogetCardInfo () const
int getId () const
void setId (int _id)
QString getName () const
QString getProviderId () const
void setCardRef (const CardRef &_cardRef)
CardRef getCardRef () const
qreal getRealZValue () const
void setRealZValue (qreal _zValue)
void setHovered (bool _hovered)
QString getColor () const
void setColor (const QString &_color)
bool getTapped () const
void setTapped (bool _tapped, bool canAnimate=false)
bool getFaceDown () const
void setFaceDown (bool _facedown)
void processHoverEvent ()
void deleteCardInfoPopup ()
Public Member Functions inherited from ArrowTarget
 ArrowTarget (Player *_owner, QGraphicsItem *parent=nullptr)
 ~ArrowTarget () override
PlayergetOwner () const
void setBeingPointedAt (bool _beingPointedAt)
bool getBeingPointedAt () const
const QList< ArrowItem * > & getArrowsFrom () const
void addArrowFrom (ArrowItem *arrow)
void removeArrowFrom (ArrowItem *arrow)
const QList< ArrowItem * > & getArrowsTo () const
void addArrowTo (ArrowItem *arrow)
void removeArrowTo (ArrowItem *arrow)
Public Member Functions inherited from AbstractGraphicsItem
 AbstractGraphicsItem (QGraphicsItem *parent=nullptr)

Protected Member Functions

void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override
void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override
QVariant itemChange (GraphicsItemChange change, const QVariant &value) override
Protected Member Functions inherited from AbstractCardItem
void transformPainter (QPainter *painter, const QSizeF &translatedSize, int angle)
void mousePressEvent (QGraphicsSceneMouseEvent *event) override
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override
QVariant itemChange (QGraphicsItem::GraphicsItemChange change, const QVariant &value) override
void cacheBgColor ()
Protected Member Functions inherited from ArrowTarget
QVariant itemChange (QGraphicsItem::GraphicsItemChange change, const QVariant &value) override
Protected Member Functions inherited from AbstractGraphicsItem
void paintNumberEllipse (int number, int radius, const QColor &color, int position, int count, QPainter *painter)

Private Member Functions

void prepareDelete ()
void handleClickedToPlay (bool shiftHeld)

Private Attributes

CardZoneLogiczone
bool attacking
QMap< int, int > counters
QString annotation
QString pt
bool destroyOnZoneChange
bool doesntUntap
QPoint gridPoint
CardDragItemdragItem
CardItemattachedTo
QList< CardItem * > attachedCards

Additional Inherited Members

Signals inherited from AbstractCardItem
void hovered (AbstractCardItem *card)
void showCardInfoPopup (const QPoint &pos, const CardRef &cardRef)
void deleteCardInfoPopup (QString cardName)
void sigPixmapUpdated ()
void cardShiftClicked (QString cardName)
Protected Attributes inherited from AbstractCardItem
ExactCard exactCard
int id
CardRef cardRef
bool tapped
bool facedown
int tapAngle
QString color
QColor bgColor
Protected Attributes inherited from ArrowTarget
Playerowner

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Type 

Constructor & Destructor Documentation

◆ CardItem()

CardItem::CardItem ( Player * _owner,
QGraphicsItem * parent = nullptr,
const CardRef & cardRef = {},
int _cardid = -1,
CardZoneLogic * _zone = nullptr )
explicit
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ addAttachedCard()

void CardItem::addAttachedCard ( CardItem * card)
inline
Here is the call graph for this function:

◆ animationEvent()

bool CardItem::animationEvent ( )
Here is the call graph for this function:

◆ createDragItem()

CardDragItem * CardItem::createDragItem ( int _id,
const QPointF & _pos,
const QPointF & _scenePos,
bool faceDown )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deleteDragItem()

void CardItem::deleteDragItem ( )
Here is the caller graph for this function:

◆ deleteLater

void CardItem::deleteLater ( )
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawArrow()

void CardItem::drawArrow ( const QColor & arrowColor)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawAttachArrow()

void CardItem::drawAttachArrow ( )
Here is the call graph for this function:

◆ getAnnotation()

QString CardItem::getAnnotation ( ) const
inlinenodiscard

◆ getAttachedCards()

const QList< CardItem * > & CardItem::getAttachedCards ( ) const
inlinenodiscard
Here is the caller graph for this function:

◆ getAttachedTo()

CardItem * CardItem::getAttachedTo ( ) const
inlinenodiscard
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAttacking()

bool CardItem::getAttacking ( ) const
inlinenodiscard

◆ getCounters()

const QMap< int, int > & CardItem::getCounters ( ) const
inlinenodiscard
Here is the caller graph for this function:

◆ getDestroyOnZoneChange()

bool CardItem::getDestroyOnZoneChange ( ) const
inlinenodiscard

◆ getDoesntUntap()

bool CardItem::getDoesntUntap ( ) const
inlinenodiscard
Here is the caller graph for this function:

◆ getGridPoint()

QPoint CardItem::getGridPoint ( ) const
inlinenodiscard

◆ getGridPos()

QPoint CardItem::getGridPos ( ) const
inlinenodiscard

◆ getOwner()

Player * CardItem::getOwner ( ) const
inlinenodiscard

◆ getPT()

QString CardItem::getPT ( ) const
inlinenodiscard
Here is the caller graph for this function:

◆ getZone()

CardZoneLogic * CardItem::getZone ( ) const
inlinenodiscard
Here is the caller graph for this function:

◆ handleClickedToPlay()

void CardItem::handleClickedToPlay ( bool shiftHeld)
private

This method is called when a "click to play" is done on the card. This is either triggered by a single click or double click, depending on the settings.

Parameters
shiftHeldif the shift key was held during the click
Here is the call graph for this function:
Here is the caller graph for this function:

◆ itemChange()

QVariant CardItem::itemChange ( GraphicsItemChange change,
const QVariant & value )
overrideprotected
Here is the call graph for this function:

◆ mouseDoubleClickEvent()

void CardItem::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent * event)
overrideprotected
Here is the call graph for this function:

◆ mouseMoveEvent()

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

◆ mouseReleaseEvent()

void CardItem::mouseReleaseEvent ( QGraphicsSceneMouseEvent * event)
overrideprotected
Here is the call graph for this function:

◆ paint()

void CardItem::paint ( QPainter * painter,
const QStyleOptionGraphicsItem * option,
QWidget * widget )
override
Here is the call graph for this function:

◆ playCard()

void CardItem::playCard ( bool faceDown)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prepareDelete()

void CardItem::prepareDelete ( )
private
Here is the caller graph for this function:

◆ processCardInfo()

void CardItem::processCardInfo ( const ServerInfo_Card & _info)
Here is the call graph for this function:

◆ removeAttachedCard()

void CardItem::removeAttachedCard ( CardItem * card)
inline
Here is the call graph for this function:

◆ resetState()

void CardItem::resetState ( bool keepAnnotations = false)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ retranslateUi()

void CardItem::retranslateUi ( )

◆ setAnnotation()

void CardItem::setAnnotation ( const QString & _annotation)
Here is the caller graph for this function:

◆ setAttachedTo()

void CardItem::setAttachedTo ( CardItem * _attachedTo)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAttacking()

void CardItem::setAttacking ( bool _attacking)
Here is the caller graph for this function:

◆ setCounter()

void CardItem::setCounter ( int _id,
int _value )
Here is the caller graph for this function:

◆ setDestroyOnZoneChange()

void CardItem::setDestroyOnZoneChange ( bool _destroy)
inline
Here is the caller graph for this function:

◆ setDoesntUntap()

void CardItem::setDoesntUntap ( bool _doesntUntap)
Here is the caller graph for this function:

◆ setGridPoint()

void CardItem::setGridPoint ( const QPoint & _gridPoint)
inline
Here is the caller graph for this function:

◆ setOwner()

void CardItem::setOwner ( Player * _owner)
inline
Here is the caller graph for this function:

◆ setPT()

void CardItem::setPT ( const QString & _pt)
Here is the caller graph for this function:

◆ setZone()

void CardItem::setZone ( CardZoneLogic * _zone)
Here is the caller graph for this function:

◆ type()

int CardItem::type ( ) const
inlinenodiscardoverride

Member Data Documentation

◆ annotation

QString CardItem::annotation
private

◆ attachedCards

QList<CardItem *> CardItem::attachedCards
private

◆ attachedTo

CardItem* CardItem::attachedTo
private

◆ attacking

bool CardItem::attacking
private

◆ counters

QMap<int, int> CardItem::counters
private

◆ destroyOnZoneChange

bool CardItem::destroyOnZoneChange
private

◆ doesntUntap

bool CardItem::doesntUntap
private

◆ dragItem

CardDragItem* CardItem::dragItem
private

◆ gridPoint

QPoint CardItem::gridPoint
private

◆ pt

QString CardItem::pt
private

◆ zone

CardZoneLogic* CardItem::zone
private

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