Description: The addMenu function of the QMenu class in C++ is used to add a sub-menu to an already-existing menu. A sub-menu can be thought of as a menu within the main menu.
In this example, we create four QMenu objects and add them to a menu bar called "menuBar". Then, we add four menu items to the "fileMenu" object.
Example 2:
QMenu *fileMenu = new QMenu(tr("File"), this); QMenu *openRecentMenu = new QMenu(tr("Open Recent"), this); fileMenu->addMenu(openRecentMenu);
In this example, we create a QMenu object called "fileMenu" and another QMenu object called "openRecentMenu". We then add "openRecentMenu" to "fileMenu" using the addMenu function.
Package/Library: This function belongs to the Qt library.
C++ (Cpp) QMenu::addMenu - 30 examples found. These are the top rated real world C++ (Cpp) examples of QMenu::addMenu extracted from open source projects. You can rate examples to help us improve the quality of examples.