Considering that mobile phones come in all shapes and sizes, it would be ridiculous to need to provide a different package for every different screen resolution. Hence we will use dynamic layouts.
The source code can be found on the Git repository under the Chapter01-layouts directory, in the cp1 branch.
Qt Widgets have support for this using classes such as QVBoxLayout and QGridLayout.
Qt Creator's designer is the easiest way to develop dynamic layouts. Let's go through how we can do that.
To set up a layout, we position a widget on the application form, and press Command or Control on the keyboard while selecting the widgets that we want to put in a layout. Here are two QPushButtons selected for use:
Next, click on the Horizontal Layout icon highlighted here:
You will then see the two widgets enclosed by a thin...