QAction* saveFileAction = new QAction(tr("Save File"), this);
QMenu* fileMenu = new QMenu(tr("File"), this); QAction* saveFileAction = new QAction(tr("Save File"), fileMenu); fileMenu->addAction(saveFileAction);In this example, a new QMenu is created with the label "File" and the parent set to the current widget. Then, a new QAction is created with the label "Save File" and the parent set to the fileMenu. Finally, the saveFileAction is added to the fileMenu. Package Library: Qt5Core.