qtictactoeboard.h 643 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef QTICTACTOEBOARD_H
  2. #define QTICTACTOEBOARD_H
  3. #include <QtWidgets/QWidget>
  4. #include "qtictactoegame.h"
  5. const int cellSize = 50;
  6. class QTicTacToeBoard : public QWidget
  7. {
  8. Q_OBJECT
  9. public:
  10. explicit QTicTacToeBoard(QWidget *parent = 0, int playersCount = 2);
  11. void setGame(QTicTacToeGame *game);
  12. void setBoardPlayer(int player);
  13. private:
  14. QTicTacToeGame *game;
  15. void paintEvent(QPaintEvent *);
  16. QSize sizeHint();
  17. void mousePressEvent(QMouseEvent *);
  18. int currPlayer;
  19. int boardPlayer;
  20. int playersCount;
  21. private slots:
  22. void turn(int x, int y, int player);
  23. };
  24. #endif // QTICTACTOEBOARD_H