QAction* newAction = new QAction(tr("New"), this); newAction->setObjectName("newAction");
QAction* openAction = new QAction(tr("Open"), this); openAction->setIcon(QIcon(":/images/icon_open.png")); openAction->setObjectName("openAction");This code creates a new QAction instance with the label "Open" and sets its object name as "openAction". It also sets an icon for the action using QIcon. Package library: The package library for this code is QtWidgets.