You have almost everything right here, but you are probably losing sight of what is very easy to miss when you first start using Qt Designer.
The layout of your grid is inside your widget with a fixed size and position. He also needs to control the layout. If you look at the object inspector in the upper right corner (which contains your hierarchy), you will probably see a top-level widget with a red icon. This means that there is no layout in it. You have two options to fix this ...
- Place the existing grid layout in another main layout (for example, a vertical layout). You just right-click on your top-level widget in Object Inspector → Lay Out → [Select the type of main layout].
- Let your grid be the main layout. To do this, you will need to remove the grid layout and arrange your child elements exactly as you have in this picture. Then follow the previous option by right-clicking on the top-level widgets (or empty background) and select Lay out → Grid. This will cause your widgets to appear in the grid with the best visual reference (which you can then fix if necessary), and your grid will be a top-level layout.
source share