O'Reilly logo

Game Programming Using Qt by Lorenz Haas, Witold Wysota

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – the logic of the dialog

Now, it is time to make our game settings dialog work. Earlier, we declared a signal-slot connection but now the slot itself needs to be implemented.

Open the form class generated by Creator. If you're still in the Design mode, you can quickly jump to the respective form class file using the Shift + F4 keyboard shortcut. Create a public slots section of the class and declare a void updateOKButtonState() slot. Open the refactorization menu (Alt + Enter) and ask Creator to create the skeleton implementation of the slot for you. Fill the function body with the following code:

void ConfigurationDialog::updateOKButtonState() { bool pl1NameEmpty = ui->player1Name->text().isEmpty(); bool pl2NameEmpty = ui->player2Name->text().isEmpty(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required