Your main application and its menus

In order to use Qt Widgets, you need to do two things. First, you need to ensure that you include the widgets module in your project by adding the following line in your project's .pro file:

QT += widgets 

Second, any file using Qt Widgets should include the QWidgets header as one of its headers. You might also need to include the header files for individual widgets, such as QButton and QMenuBar:

#include <QWidgets> 

Qt provides the QGuiApplication class (a subclass of QCoreApplication) to manage your application's life cycle, including the event loop required by today's GUI platforms. You've already seen QCoreApplication, which we used for our console application in Chapter 1, Getting Started with Qt Creator ...

Get Application Development with Qt Creator 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.