I'm trying to display "Game Over" once the player runs out of lives. However, it's never displayed after the game ends. Here is some example code.
void Game::end()
{
QGraphicsTextItem *text = new QGraphicsTextItem("GameOver");
text->setPos(400, 500);
scene->addItem(text);
sleep(2);
QApplication::quit();
}