In a QVBoxLayout layout, widgets are aligned vertically and they are packed in the layout from top to bottom.
Consider the following diagram:
For QVBoxLayout, the arrow gives the direction of growth in which the widgets are added to the layout. The first widget, widget 1, will occupy the top of the layout, while the last call to addWidget() will make widget 5 occupy the bottom of the layout.
To illustrate how to use the QVBoxLayout, consider the following program:
#include <QApplication>#include <QVBoxLayout>#include <QPushButton>#include <QLabel>#include <QLineEdit>int main(int argc, char *argv[]){ QApplication app(argc, argv); ...