setRowStretch is to set the ratio of the row height to the total row height.
For example, there is a gridlayout with 4 rows. If you want their row height ratio to be 1:3:5:7, set it like this:
To achieve centering, I usually add two spring controls on the left and right sides of the control, that is, QSpacerItem;
If I simply use gridlayout to implement a layout like the one shown in the figure, I don’t have a good solution for the time being. My usual approach is to use table layout and put a horizontal layout, then put the required controls in the horizontal layout and center the controls.
setRowStretch is to set the ratio of the row height to the total row height.
For example, there is a gridlayout with 4 rows. If you want their row height ratio to be 1:3:5:7, set it like this:
setColumnStretch sets the column width.
To achieve centering, I usually add two spring controls on the left and right sides of the control, that is, QSpacerItem;
If I simply use gridlayout to implement a layout like the one shown in the figure, I don’t have a good solution for the time being. My usual approach is to use table layout and put a horizontal layout, then put the required controls in the horizontal layout and center the controls.