April 2018
Beginner
714 pages
18h 21m
English
QWidget (and, by extension, any widget class) has a font property that determines the properties of the font this widget uses. This property has the QFont type. We can't just write label->font()->setBold(isBold);, because font() returns a const reference, so we have to make a copy of the QFont object. That copy has no connection to the label, so we need to call label->setFont(f) to apply our changes. To avoid repetition of this procedure, we created a helper function, called setLabelBold.
The last thing that needs to be done is to handle the situation when the game ends. Connect the gameOver() signal from the board to a new slot in the main window class. Implement the slot as follows:
void MainWindow::handleGameOver(TicTacToeWidget::Player ...
Read now
Unlock full access