April 2018
Beginner
714 pages
18h 21m
English
Printing text to the console is not as impressive as changing the text in our form. We don't have GUI for letting users enter their names yet, so we'll hardcode some names for now. Let's change the implementation of our slot to the following:
void MainWindow::startNewGame()
{
ui->player1Name->setText(tr("Alice"));
ui->player2Name->setText(tr("Bob"));
}
Now, when you run the application and click on the button, the labels in the form will change. Let's break down this code into pieces:
Read now
Unlock full access