Main menu and toolbars

As you may remember, any widget that has no parent will be displayed as a window. However, when we created our main window, we selected QMainWindow as the base class. If we had selected QWidget instead, we would still be able to do everything we did up to this point. However, the QMainWindow class provides some unique functionality that we will now use.

A main window represents the control center of an application. It can contain menus, toolbars, docking widgets, a status bar, and the central widget that contains the main content of the window, as shown in the following diagram:

If you open the mainwindow.ui file and ...

Get Game Programming using Qt 5 Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.