To create a window(ed) application, we usually call the show() method on an instance of QWidget and that makes that widget, to be contained in a window of its own, along with its child widgets displayed in it.
A recap of such a simple application is as follows:
#include <QApplication>
#include <QMainWindow>
#include <QLabel>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QMainWindow mainWindow;
mainWindow.show();
return a.exec();
}
mainWindow here is an instance of QMainWindow, which is derived from QWidget. As such, by calling the show() method, a window will appear. If you were to replace QMainWindow with QLabel, this will still work.
But this style of writing applications is not the best. Instead, from this point onward, we shall define our own custom widget, in which we shall define child widgets and make connections...