January 2016
Beginner
512 pages
12h 35m
English
In this exercise, we will be adding a useful property to the board class. The property is going to hold information about the player who should make the next move. The type of the property is going to be the TicTacToeWidget::Player enumeration that we created earlier. For the getter and the setter methods, we are going to use the two functions that we created earlier: currentPlayer() and setCurrentPlayer().
Open the header file for our class and modify the class definition as shown in the following code:
class TicTacToeWidget : public QWidget {
Q_OBJECT
Q_ENUMS(Player)
Q_PROPERTY(Player currentPlayer READ currentPlayer
WRITE setCurrentPlayer
NOTIFY currentPlayerChanged) public: enum Player ...