Qt5 Tutorial Layouts without Designer - 2017

In this tutorial, we will learn Layouts of Qt. We will add layouts to a form and add widgets to the layout programmatically instead of using Designer as was done in the Layouts.

We will create an empty project and will create 6 PushButtons. Then, we will arrange 3 buttons with horizontal layout, and the other three with vertical layout. The two layouts will be added to the the outer most layout, and then we pass the outer layout to our widget using setLayout().

File->Other Project->Empty Qt Project

There is none in the Project explorer, and even the .pro has nothing in it. So, we need to create a file main.cpp by Add New...