#include#include QMenu* menu = new QMenu("File", this); // creates a menu QAction* openAction = new QAction("Open", this); // creates an action for menu menu->addAction(openAction); // adds an action to the menu
QAction* saveAction = new QAction("Save", this); saveAction->setShortcut(QKeySequence::Save); // sets a shortcut
QAction* undoAction = new QAction("Undo", this); undoAction->setEnabled(false); // disables the action undoAction->setEnabled(true); // enables the actionThe package library for QAction is "Qt Widgets" and it is included in the QtCore and QtGui modules.