1

Sorry for bad english. I have 2 horizontal layouts with buttons and text edits and a grid layout with buttons. Form has vertical layout. I need buttons with text edits resize vertically same as buttons in grid layout. Now I can make only one of the parts of form resize: when buttons in horizontal layouts have size policy expanding, grid layout does not resize, otherwise only grid layout resizes.

Screenshots

enter image description here

enter image description here

enter image description here

mainwindow.ui file

m7913d
  • 10,244
  • 7
  • 28
  • 56
  • Did you consider to layout everything with only one `QGridLayout`? Don't know how to do this with Qt Designer but in C++ it is easy to attach `QWidget`s to multiple rows and/or columns. – Scheff's Cat Apr 07 '17 at 18:03
  • I don't have time to go through a thousand line of UI file but... from the images it looks as if you need to assign *all* of the vertical stretch to the grid layout. – G.M. Apr 07 '17 at 18:11
  • Thanks, adding all to grid layout helped http://imgur.com/a/lY0Uu – Maxim Falaleev Apr 07 '17 at 18:36
  • This is indeed a possibility, but depending on what you want, my answer gives you more flexibility. – m7913d Apr 07 '17 at 18:42

1 Answers1

1

The problem resides in the stretch distribution of the verticalLayout (QVBoxLayout) of the centralWidget. At the moment space is rather equally distributed (taking minimum size into account) over the two vertical layouts and the grid layout. What you probably want is a distribution of 1 (vertical layouts) to 7 (grid layout), because there are 7 rows in the grid layout. So, you should change the centralWidget > Layout > layoutStretch factor to 1,1,0,7. (0 is for the vertical line)

enter image description here

m7913d
  • 10,244
  • 7
  • 28
  • 56
  • _[...] because there are 7 rows in the grid layout_. That's something I never thought of when I had similar issues. Learned something new! – king_nak Jun 06 '17 at 08:03