The visual part of the game is ready and what remains is to complete the logic of the main window and put all the pieces together. Add a public slot to the class and call it
startNewGame. In the class constructor, connect the New Game action's triggered signal to this slot and connect the application's quit slot to the other action:
connect(ui->actionNewGame, SIGNAL(triggered()), this, SLOT(startNewGame())); connect(ui->actionQuit, SIGNAL(triggered()), qApp, SLOT(quit()));
qApp special macro represents a pointer to the application object instance, so the preceding code will call the
quit() slot on the
QApplication object created in
main(), which in turn will eventually cause the application to end.