add missing override and explicit specifiers to all classes in src/game (#5511)

This commit is contained in:
RickyRister 2025-01-22 04:57:56 -08:00 committed by GitHub
parent af161f00b7
commit 66e2e7a473
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 140 additions and 137 deletions

View file

@ -88,7 +88,7 @@ public:
AbstractCounterDialog(const QString &name, const QString &value, QWidget *parent = nullptr); AbstractCounterDialog(const QString &name, const QString &value, QWidget *parent = nullptr);
protected: protected:
bool eventFilter(QObject *obj, QEvent *event); bool eventFilter(QObject *obj, QEvent *event) override;
void changeValue(int diff); void changeValue(int diff);
}; };

View file

@ -24,7 +24,7 @@ protected:
void paintNumberEllipse(int number, int radius, const QColor &color, int position, int count, QPainter *painter); void paintNumberEllipse(int number, int radius, const QColor &color, int position, int count, QPainter *painter);
public: public:
AbstractGraphicsItem(QGraphicsItem *parent = nullptr) : QObject(), QGraphicsItem(parent) explicit AbstractGraphicsItem(QGraphicsItem *parent = nullptr) : QGraphicsItem(parent)
{ {
} }
}; };

View file

@ -24,17 +24,17 @@ protected:
bool targetLocked; bool targetLocked;
QColor color; QColor color;
bool fullColor; bool fullColor;
void mousePressEvent(QGraphicsSceneMouseEvent *event); void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
public: public:
ArrowItem(Player *_player, int _id, ArrowTarget *_startItem, ArrowTarget *_targetItem, const QColor &color); ArrowItem(Player *_player, int _id, ArrowTarget *_startItem, ArrowTarget *_targetItem, const QColor &color);
~ArrowItem(); ~ArrowItem() override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
QRectF boundingRect() const QRectF boundingRect() const override
{ {
return path.boundingRect(); return path.boundingRect();
} }
QPainterPath shape() const QPainterPath shape() const override
{ {
return path; return path;
} }
@ -83,8 +83,8 @@ public:
void addChildArrow(ArrowDragItem *childArrow); void addChildArrow(ArrowDragItem *childArrow);
protected: protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
}; };
class ArrowAttachItem : public ArrowItem class ArrowAttachItem : public ArrowItem
@ -96,12 +96,12 @@ private:
void attachCards(CardItem *startCard, const CardItem *targetCard); void attachCards(CardItem *startCard, const CardItem *targetCard);
public: public:
ArrowAttachItem(ArrowTarget *_startItem); explicit ArrowAttachItem(ArrowTarget *_startItem);
void addChildArrow(ArrowAttachItem *childArrow); void addChildArrow(ArrowAttachItem *childArrow);
protected: protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
}; };
#endif // ARROWITEM_H #endif // ARROWITEM_H

View file

@ -19,8 +19,8 @@ private:
QList<ArrowItem *> arrowsFrom, arrowsTo; QList<ArrowItem *> arrowsFrom, arrowsTo;
public: public:
ArrowTarget(Player *_owner, QGraphicsItem *parent = nullptr); explicit ArrowTarget(Player *_owner, QGraphicsItem *parent = nullptr);
~ArrowTarget(); ~ArrowTarget() override;
Player *getOwner() const Player *getOwner() const
{ {

View file

@ -20,8 +20,8 @@ public:
bool useNameForShortcut = false, bool useNameForShortcut = false,
QGraphicsItem *parent = nullptr, QGraphicsItem *parent = nullptr,
QWidget *game = nullptr); QWidget *game = nullptr);
QRectF boundingRect() const; QRectF boundingRect() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
}; };
#endif #endif

View file

@ -26,7 +26,7 @@ public:
return Type; return Type;
} }
AbstractCardDragItem(AbstractCardItem *_item, const QPointF &_hotSpot, AbstractCardDragItem *parentDrag = 0); AbstractCardDragItem(AbstractCardItem *_item, const QPointF &_hotSpot, AbstractCardDragItem *parentDrag = 0);
~AbstractCardDragItem(); ~AbstractCardDragItem() override;
QRectF boundingRect() const override QRectF boundingRect() const override
{ {
return QRectF(0, 0, CARD_WIDTH, CARD_HEIGHT); return QRectF(0, 0, CARD_WIDTH, CARD_HEIGHT);

View file

@ -48,12 +48,12 @@ public:
{ {
return Type; return Type;
} }
AbstractCardItem(QGraphicsItem *parent = nullptr, explicit AbstractCardItem(QGraphicsItem *parent = nullptr,
const QString &_name = QString(), const QString &_name = QString(),
const QString &_providerId = QString(), const QString &_providerId = QString(),
Player *_owner = nullptr, Player *_owner = nullptr,
int _id = -1); int _id = -1);
~AbstractCardItem(); ~AbstractCardItem() override;
QRectF boundingRect() const override; QRectF boundingRect() const override;
QPainterPath shape() const override; QPainterPath shape() const override;
QSizeF getTranslatedSize(QPainter *painter) const; QSizeF getTranslatedSize(QPainter *painter) const;

View file

@ -28,11 +28,11 @@ public:
{ {
return faceDown; return faceDown;
} }
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
void updatePosition(const QPointF &cursorScenePos); void updatePosition(const QPointF &cursorScenePos) override;
protected: protected:
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
}; };
#endif #endif

View file

@ -46,25 +46,25 @@ public:
{ {
Type = typeCard Type = typeCard
}; };
int type() const int type() const override
{ {
return Type; return Type;
} }
CardItem(Player *_owner, explicit CardItem(Player *_owner,
QGraphicsItem *parent = nullptr, QGraphicsItem *parent = nullptr,
const QString &_name = QString(), const QString &_name = QString(),
const QString &_providerId = QString(), const QString &_providerId = QString(),
int _cardid = -1, int _cardid = -1,
bool revealedCard = false, bool revealedCard = false,
CardZone *_zone = nullptr); CardZone *_zone = nullptr);
~CardItem(); ~CardItem() override;
void retranslateUi(); void retranslateUi();
CardZone *getZone() const CardZone *getZone() const
{ {
return zone; return zone;
} }
void setZone(CardZone *_zone); void setZone(CardZone *_zone);
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
QPoint getGridPoint() const QPoint getGridPoint() const
{ {
return gridPoint; return gridPoint;
@ -163,10 +163,10 @@ public:
void playCard(bool faceDown); void playCard(bool faceDown);
protected: protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
QVariant itemChange(GraphicsItemChange change, const QVariant &value); QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
}; };
#endif #endif

View file

@ -34,7 +34,7 @@ public:
SortBySet, SortBySet,
SortByPrinting SortByPrinting
}; };
CardList(bool _contentsKnown); explicit CardList(bool _contentsKnown);
CardItem *findCard(const int cardId) const; CardItem *findCard(const int cardId) const;
bool getContentsKnown() const bool getContentsKnown() const
{ {

View file

@ -24,20 +24,20 @@ private:
DeckViewCardDragItem *dragItem; DeckViewCardDragItem *dragItem;
public: public:
DeckViewCard(QGraphicsItem *parent = nullptr, explicit DeckViewCard(QGraphicsItem *parent = nullptr,
const QString &_name = QString(), const QString &_name = QString(),
const QString &_providerId = QString(), const QString &_providerId = QString(),
const QString &_originZone = QString()); const QString &_originZone = QString());
~DeckViewCard(); ~DeckViewCard() override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
const QString &getOriginZone() const const QString &getOriginZone() const
{ {
return originZone; return originZone;
} }
protected: protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
void hoverEnterEvent(QGraphicsSceneHoverEvent *event); void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
}; };
class DeckViewCardDragItem : public AbstractCardDragItem class DeckViewCardDragItem : public AbstractCardDragItem
@ -48,10 +48,10 @@ private:
public: public:
DeckViewCardDragItem(DeckViewCard *_item, const QPointF &_hotSpot, AbstractCardDragItem *parentDrag = 0); DeckViewCardDragItem(DeckViewCard *_item, const QPointF &_hotSpot, AbstractCardDragItem *parentDrag = 0);
void updatePosition(const QPointF &cursorScenePos); void updatePosition(const QPointF &cursorScenePos) override;
protected: protected:
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
}; };
class DeckViewCardContainer : public QGraphicsItem class DeckViewCardContainer : public QGraphicsItem
@ -73,13 +73,13 @@ public:
{ {
Type = typeDeckViewCardContainer Type = typeDeckViewCardContainer
}; };
int type() const int type() const override
{ {
return Type; return Type;
} }
DeckViewCardContainer(const QString &_name); explicit DeckViewCardContainer(const QString &_name);
QRectF boundingRect() const; QRectF boundingRect() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
void addCard(DeckViewCard *card); void addCard(DeckViewCard *card);
void removeCard(DeckViewCard *card); void removeCard(DeckViewCard *card);
const QList<DeckViewCard *> &getCards() const const QList<DeckViewCard *> &getCards() const
@ -113,8 +113,8 @@ private:
void rebuildTree(); void rebuildTree();
public: public:
DeckViewScene(QObject *parent = nullptr); explicit DeckViewScene(QObject *parent = nullptr);
~DeckViewScene(); ~DeckViewScene() override;
void setLocked(bool _locked) void setLocked(bool _locked)
{ {
locked = _locked; locked = _locked;
@ -142,7 +142,7 @@ private:
DeckViewScene *deckViewScene; DeckViewScene *deckViewScene;
protected: protected:
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event) override;
public slots: public slots:
void updateSceneRect(const QRectF &rect); void updateSceneRect(const QRectF &rect);
signals: signals:
@ -150,7 +150,7 @@ signals:
void sideboardPlanChanged(); void sideboardPlanChanged();
public: public:
DeckView(QWidget *parent = nullptr); explicit DeckView(QWidget *parent = nullptr);
void setDeck(const DeckList &_deck); void setDeck(const DeckList &_deck);
void setLocked(bool _locked) void setLocked(bool _locked)
{ {
@ -160,7 +160,7 @@ public:
{ {
return deckViewScene->getSideboardPlan(); return deckViewScene->getSideboardPlan();
} }
void mouseDoubleClickEvent(QMouseEvent *event); void mouseDoubleClickEvent(QMouseEvent *event) override;
void resetSideboardPlan(); void resetSideboardPlan();
}; };

View file

@ -21,8 +21,8 @@ private:
void destroyFilter(); void destroyFilter();
public: public:
FilterBuilder(QWidget *parent = nullptr); explicit FilterBuilder(QWidget *parent = nullptr);
~FilterBuilder(); ~FilterBuilder() override;
signals: signals:
void add(const CardFilter *f); void add(const CardFilter *f);

View file

@ -28,19 +28,19 @@ private:
public: public:
FilterTreeModel(QObject *parent = nullptr); FilterTreeModel(QObject *parent = nullptr);
~FilterTreeModel(); ~FilterTreeModel() override;
FilterTree *filterTree() const FilterTree *filterTree() const
{ {
return fTree; return fTree;
} }
int rowCount(const QModelIndex &parent = QModelIndex()) const; int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex & /*parent*/ = QModelIndex()) const; int columnCount(const QModelIndex & /*parent*/ = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role) const; QVariant data(const QModelIndex &index, int role) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
Qt::ItemFlags flags(const QModelIndex &index) const; Qt::ItemFlags flags(const QModelIndex &index) const override;
QModelIndex parent(const QModelIndex &ind) const; QModelIndex parent(const QModelIndex &ind) const override;
QModelIndex index(int row, int column, const QModelIndex &parent) const; QModelIndex index(int row, int column, const QModelIndex &parent) const override;
bool removeRows(int row, int count, const QModelIndex &parent); bool removeRows(int row, int count, const QModelIndex &parent) override;
}; };
#endif #endif

View file

@ -37,8 +37,8 @@ private:
void updateHover(const QPointF &scenePos); void updateHover(const QPointF &scenePos);
public: public:
GameScene(PhasesToolbar *_phasesToolbar, QObject *parent = nullptr); explicit GameScene(PhasesToolbar *_phasesToolbar, QObject *parent = nullptr);
~GameScene(); ~GameScene() override;
void retranslateUi(); void retranslateUi();
void processViewSizeChange(const QSize &newSize); void processViewSizeChange(const QSize &newSize);
QTransform getViewTransform() const; QTransform getViewTransform() const;
@ -65,8 +65,8 @@ public slots:
void rearrange(); void rearrange();
protected: protected:
bool event(QEvent *event); bool event(QEvent *event) override;
void timerEvent(QTimerEvent *event); void timerEvent(QTimerEvent *event) override;
signals: signals:
void sigStartRubberBand(const QPointF &selectionOrigin); void sigStartRubberBand(const QPointF &selectionOrigin);
void sigResizeRubberBand(const QPointF &cursorPoint); void sigResizeRubberBand(const QPointF &cursorPoint);

View file

@ -15,7 +15,7 @@ private:
QPointF selectionOrigin; QPointF selectionOrigin;
protected: protected:
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event) override;
private slots: private slots:
void startRubberBand(const QPointF &selectionOrigin); void startRubberBand(const QPointF &selectionOrigin);
void resizeRubberBand(const QPointF &cursorPoint); void resizeRubberBand(const QPointF &cursorPoint);
@ -25,7 +25,7 @@ public slots:
void updateSceneRect(const QRectF &rect); void updateSceneRect(const QRectF &rect);
public: public:
GameView(GameScene *scene, QWidget *parent = nullptr); explicit GameView(GameScene *scene, QWidget *parent = nullptr);
}; };
#endif #endif

View file

@ -27,16 +27,16 @@ public:
static const int SORT_ROLE = Qt::UserRole + 1; static const int SORT_ROLE = Qt::UserRole + 1;
GamesModel(const QMap<int, QString> &_rooms, const QMap<int, GameTypeMap> &_gameTypes, QObject *parent = nullptr); GamesModel(const QMap<int, QString> &_rooms, const QMap<int, GameTypeMap> &_gameTypes, QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const int rowCount(const QModelIndex &parent = QModelIndex()) const override
{ {
return parent.isValid() ? 0 : gameList.size(); return parent.isValid() ? 0 : gameList.size();
} }
int columnCount(const QModelIndex & /*parent*/ = QModelIndex()) const int columnCount(const QModelIndex & /*parent*/ = QModelIndex()) const override
{ {
return NUM_COLS; return NUM_COLS;
} }
QVariant data(const QModelIndex &index, int role) const; QVariant data(const QModelIndex &index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
static const QString getGameCreatedString(const int secs); static const QString getGameCreatedString(const int secs);
const ServerInfo_Game &getGame(int row); const ServerInfo_Game &getGame(int row);
@ -88,7 +88,7 @@ private:
showOnlyIfSpectatorsCanSeeHands; showOnlyIfSpectatorsCanSeeHands;
public: public:
GamesProxyModel(QObject *parent = nullptr, const UserListProxy *_userListProxy = nullptr); explicit GamesProxyModel(QObject *parent = nullptr, const UserListProxy *_userListProxy = nullptr);
bool getShowBuddiesOnlyGames() const bool getShowBuddiesOnlyGames() const
{ {
@ -173,7 +173,7 @@ public:
void refresh(); void refresh();
protected: protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
bool filterAcceptsRow(int sourceRow) const; bool filterAcceptsRow(int sourceRow) const;
}; };

View file

@ -15,7 +15,7 @@ private:
int number; int number;
protected: protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event); void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
public slots: public slots:
void updateNumber(); void updateNumber();
signals: signals:
@ -26,14 +26,14 @@ public:
{ {
Type = typeOther Type = typeOther
}; };
int type() const int type() const override
{ {
return Type; return Type;
} }
HandCounter(QGraphicsItem *parent = nullptr); explicit HandCounter(QGraphicsItem *parent = nullptr);
~HandCounter(); ~HandCounter() override;
QRectF boundingRect() const; QRectF boundingRect() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
}; };
#endif #endif

View file

@ -522,7 +522,7 @@ class AnnotationDialog : public QInputDialog
void keyPressEvent(QKeyEvent *e) override; void keyPressEvent(QKeyEvent *e) override;
public: public:
AnnotationDialog(QWidget *parent) : QInputDialog(parent) explicit AnnotationDialog(QWidget *parent) : QInputDialog(parent)
{ {
} }
}; };

View file

@ -15,16 +15,18 @@ class UserContextMenu;
class PlayerListItemDelegate : public QStyledItemDelegate class PlayerListItemDelegate : public QStyledItemDelegate
{ {
public: public:
PlayerListItemDelegate(QObject *const parent); explicit PlayerListItemDelegate(QObject *parent);
bool bool editorEvent(QEvent *event,
editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index); QAbstractItemModel *model,
const QStyleOptionViewItem &option,
const QModelIndex &index) override;
}; };
class PlayerListTWI : public QTreeWidgetItem class PlayerListTWI : public QTreeWidgetItem
{ {
public: public:
PlayerListTWI(); PlayerListTWI();
bool operator<(const QTreeWidgetItem &other) const; bool operator<(const QTreeWidgetItem &other) const override;
}; };
class PlayerListWidget : public QTreeWidget class PlayerListWidget : public QTreeWidget

View file

@ -19,8 +19,8 @@ public:
int _value, int _value,
QGraphicsItem *parent = nullptr, QGraphicsItem *parent = nullptr,
QWidget *game = nullptr); QWidget *game = nullptr);
QRectF boundingRect() const; QRectF boundingRect() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
}; };
class PlayerTarget : public ArrowTarget class PlayerTarget : public ArrowTarget
@ -38,15 +38,15 @@ public:
{ {
Type = typePlayerTarget Type = typePlayerTarget
}; };
int type() const int type() const override
{ {
return Type; return Type;
} }
PlayerTarget(Player *_player = nullptr, QGraphicsItem *parentItem = nullptr, QWidget *_game = nullptr); explicit PlayerTarget(Player *_player = nullptr, QGraphicsItem *parentItem = nullptr, QWidget *_game = nullptr);
~PlayerTarget(); ~PlayerTarget() override;
QRectF boundingRect() const; QRectF boundingRect() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
AbstractCounter *addCounter(int _counterId, const QString &_name, int _value); AbstractCounter *addCounter(int _counterId, const QString &_name, int _value);
}; };

View file

@ -37,8 +37,8 @@ protected:
bool isShufflable; bool isShufflable;
bool isView; bool isView;
bool alwaysRevealTopCard; bool alwaysRevealTopCard;
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
void mousePressEvent(QGraphicsSceneMouseEvent *event); void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
virtual void addCardImpl(CardItem *card, int x, int y) = 0; virtual void addCardImpl(CardItem *card, int x, int y) = 0;
signals: signals:
void cardCountChanged(); void cardCountChanged();
@ -54,7 +54,7 @@ public:
{ {
Type = typeZone Type = typeZone
}; };
int type() const int type() const override
{ {
return Type; return Type;
} }

View file

@ -15,14 +15,14 @@ public slots:
public: public:
HandZone(Player *_p, bool _contentsKnown, int _zoneHeight, QGraphicsItem *parent = nullptr); HandZone(Player *_p, bool _contentsKnown, int _zoneHeight, QGraphicsItem *parent = nullptr);
void handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &dropPoint); void handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &dropPoint) override;
QRectF boundingRect() const; QRectF boundingRect() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
void reorganizeCards(); void reorganizeCards() override;
void setWidth(qreal _width); void setWidth(qreal _width);
protected: protected:
void addCardImpl(CardItem *card, int x, int y); void addCardImpl(CardItem *card, int x, int y) override;
}; };
#endif #endif

View file

@ -16,9 +16,9 @@ private:
QSet<CardItem *> cardsInSelectionRect; QSet<CardItem *> cardsInSelectionRect;
protected: protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
void mousePressEvent(QGraphicsSceneMouseEvent *event); void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
public: public:
SelectZone(Player *_player, SelectZone(Player *_player,

View file

@ -13,13 +13,13 @@ private slots:
public: public:
StackZone(Player *_p, int _zoneHeight, QGraphicsItem *parent = nullptr); StackZone(Player *_p, int _zoneHeight, QGraphicsItem *parent = nullptr);
void handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &dropPoint); void handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &dropPoint) override;
QRectF boundingRect() const; QRectF boundingRect() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
void reorganizeCards(); void reorganizeCards() override;
protected: protected:
void addCardImpl(CardItem *card, int x, int y); void addCardImpl(CardItem *card, int x, int y) override;
}; };
#endif #endif

View file

@ -89,7 +89,7 @@ public slots:
/** /**
Reorganizes CardItems in the TableZone Reorganizes CardItems in the TableZone
*/ */
void reorganizeCards(); void reorganizeCards() override;
public: public:
/** /**
@ -98,12 +98,12 @@ public:
@param _p the Player @param _p the Player
@param parent defaults to null @param parent defaults to null
*/ */
TableZone(Player *_p, QGraphicsItem *parent = nullptr); explicit TableZone(Player *_p, QGraphicsItem *parent = nullptr);
/** /**
@return a QRectF of the TableZone bounding box. @return a QRectF of the TableZone bounding box.
*/ */
QRectF boundingRect() const; QRectF boundingRect() const override;
/** /**
Render the TableZone Render the TableZone
@ -111,7 +111,7 @@ public:
@param painter @param painter
@param option @param option
*/ */
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
/** /**
Toggles the selected items as tapped. Toggles the selected items as tapped.
@ -121,7 +121,7 @@ public:
/** /**
See HandleDropEventByGrid See HandleDropEventByGrid
*/ */
void handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &dropPoint); void handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &dropPoint) override;
/** /**
Handles the placement of cards Handles the placement of cards
@ -138,7 +138,7 @@ public:
*/ */
CardItem *getCardFromCoords(const QPointF &point) const; CardItem *getCardFromCoords(const QPointF &point) const;
QPointF closestGridPoint(const QPointF &point); QPointF closestGridPoint(const QPointF &point) override;
static int clampValidTableRow(const int row); static int clampValidTableRow(const int row);
@ -150,7 +150,7 @@ public:
@param canResize defaults to true @param canResize defaults to true
@return CardItem that has been removed @return CardItem that has been removed
*/ */
CardItem *takeCard(int position, int cardId, bool canResize = true); CardItem *takeCard(int position, int cardId, bool canResize = true) override;
/** /**
Resizes the TableZone in case CardItems are within or Resizes the TableZone in case CardItems are within or
@ -178,7 +178,7 @@ public:
} }
protected: protected:
void addCardImpl(CardItem *card, int x, int y); void addCardImpl(CardItem *card, int x, int y) override;
private: private:
void paintZoneOutline(QPainter *painter); void paintZoneOutline(QPainter *painter);

View file

@ -33,7 +33,6 @@ private:
QRectF bRect, optimumRect; QRectF bRect, optimumRect;
int minRows, numberCards; int minRows, numberCards;
void handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &dropPoint);
CardZone *origZone; CardZone *origZone;
bool revealZone, writeableRevealZone; bool revealZone, writeableRevealZone;
CardList::SortOption groupBy, sortBy; CardList::SortOption groupBy, sortBy;
@ -57,6 +56,8 @@ private:
GridSize positionCardsForDisplay(CardList &cards, CardList::SortOption pileOption = CardList::NoSort); GridSize positionCardsForDisplay(CardList &cards, CardList::SortOption pileOption = CardList::NoSort);
void handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &dropPoint) override;
public: public:
ZoneViewZone(Player *_p, ZoneViewZone(Player *_p,
CardZone *_origZone, CardZone *_origZone,
@ -65,16 +66,16 @@ public:
bool _writeableRevealZone = false, bool _writeableRevealZone = false,
QGraphicsItem *parent = nullptr, QGraphicsItem *parent = nullptr,
bool _isReversed = false); bool _isReversed = false);
QRectF boundingRect() const; QRectF boundingRect() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
void reorganizeCards(); void reorganizeCards() override;
void initializeCards(const QList<const ServerInfo_Card *> &cardList = QList<const ServerInfo_Card *>()); void initializeCards(const QList<const ServerInfo_Card *> &cardList = QList<const ServerInfo_Card *>());
void removeCard(int position); void removeCard(int position);
int getNumberCards() const int getNumberCards() const
{ {
return numberCards; return numberCards;
} }
void setGeometry(const QRectF &rect); void setGeometry(const QRectF &rect) override;
QRectF getOptimumRect() const QRectF getOptimumRect() const
{ {
return optimumRect; return optimumRect;
@ -105,9 +106,9 @@ signals:
void wheelEventReceived(QGraphicsSceneWheelEvent *event); void wheelEventReceived(QGraphicsSceneWheelEvent *event);
protected: protected:
void addCardImpl(CardItem *card, int x, int y); void addCardImpl(CardItem *card, int x, int y) override;
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override;
void wheelEvent(QGraphicsSceneWheelEvent *event); void wheelEvent(QGraphicsSceneWheelEvent *event) override;
}; };
#endif #endif

View file

@ -66,8 +66,8 @@ private slots:
void resizeToZoneContents(); void resizeToZoneContents();
void handleScrollBarChange(int value); void handleScrollBarChange(int value);
void zoneDeleted(); void zoneDeleted();
void moveEvent(QGraphicsSceneMoveEvent * /* event */); void moveEvent(QGraphicsSceneMoveEvent * /* event */) override;
void resizeEvent(QGraphicsSceneResizeEvent * /* event */); void resizeEvent(QGraphicsSceneResizeEvent * /* event */) override;
public: public:
ZoneViewWidget(Player *_player, ZoneViewWidget(Player *_player,
@ -88,8 +88,8 @@ public:
void retranslateUi(); void retranslateUi();
protected: protected:
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event) override;
void initStyleOption(QStyleOption *option) const; void initStyleOption(QStyleOption *option) const override;
}; };
#endif #endif