tictactoe.h

来自「QT4 gui programming的随书光盘」· C头文件 代码 · 共 37 行

H
37
字号
#ifndef TICTACTOE_H#define TICTACTOE_H#include <QWidget>class TicTacToe : public QWidget{    Q_OBJECTpublic:    TicTacToe(QWidget *parent = 0);    bool gameInProgress() const;    QString saveState() const;    QSize sizeHint() const;protected:    void paintEvent(QPaintEvent *event);    void mousePressEvent(QMouseEvent *event);private:    enum { Empty = '-', Cross = 'X', Nought = 'O' };    void clearBoard();    void restoreState();    QString sessionFileName() const;    QRect cellRect(int row, int column) const;    int cellWidth() const { return width() / 3; }    int cellHeight() const { return height() / 3; }    bool threeInARow(int row1, int col1, int row3, int col3) const;    char board[3][3];    int turnNumber;};#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?