Most applications hold a set of clickable(s) that reveal a list of another set of actions that expose more functionality to the user. The most popular among these are the File, Edit, and Help menus.
In Qt, menu bars occupy the very top of the window. We shall create a short program to make use of the menu bar.
Three files must be created in a newly created folder. These are as follows:
- main.cpp
- mainwindow.h
- mainwindow.cpp
The main.cpp file will remain as before in terms of content. Therefore, copy the main.cpp file from the previous section. Let's examine the mainwindow.h file:
#ifndef MAINWINDOW_H#define MAINWINDOW_H#include <QMainWindow>#include <QApplication>#include <QAction>#include <QtGui>#include <QAction>#include <QMenuBar> ...