If you want to prevent the boxes from expanding vertically, restrict it with one of the properties, don't use spacers. Is just neater and easier to work with.

It's hard to understand. How to do? If I don't add one more spacer, the QGroupBox will be compressed to a line, but it will still add two more cells.

Can anyone help?