QT multi-control changes size and position with the form (ui layout)

How do multiple controls in the QT interface change their size and position as the main interface changes?

As a newbie, without writing code, this function can be achieved just through the multi-layout settings of the UI interface.

(1) Place controls in the form, and set the horizontal, vertical, or grid layout for each part of the controls.

As shown in the main interface as shown below, a tabwidget control is placed in which three widgets are placed; buttons are placed below and on the right.

1. First place horizontal and vertical springs between each button, set the horizontal layout for the first row of buttons and the second row of buttons below, and then select these two rows to set the vertical layout; set the vertical layout directly for the 4 buttons on the right.

2. Click the tabwidget control to set the grid layout, and then select the 3 widgets inside to set the grid layout. At this time, if they are reduced, you need to manually enlarge them.

(2) Click on a blank area of ​​the form and set the layout to grid layout. Note that it must be a blank area of ​​the form! ! ! Otherwise it has no effect.

Run interface:

Maximize the interface:

Zoom in and out at will:

 It can be successfully implemented. I will try to write event processing in the future.

Guess you like

Origin blog.csdn.net/qq_46024026/article/details/133793269