QAction *myAction = new QAction(this); myAction->setText("New Game");
QAction *myAction = ui->actionNew_Game; myAction->setText("Start Over");In this example, we retrieve an existing QAction object (which was created using the Qt Designer and assigned to a slot in the UI) and update its text to "Start Over" using the setText function. Package library: The QAction class is part of the Qt Widgets module, which is included in the Qt framework.