Solved Layout issue
-
@SPlatten said in Layout issue:
Just to be absolutely clear I don't want space, I want the content of the QGridLayout to resize as the container is dragged.
I had no idea that was what you wanted. That's why I asked each time.
So I think you need to set the grid layout (as a whole, not an individual row) to occupy as much height as possible. Now is that what you want?
-
@JonB , ok, please elaborate, its sounds like thats what I need, how do I do that?
-
@SPlatten
Dunno, I just play till I get what I want :) At least we finally seem to be agreeing about what that is!Don't you have to set the grid in the vertical layout to expand its height as much as possible?
Is QBoxLayout::addLayout(QLayout *layout, int stretch = 0) what is wanted? With a non-0 stretch.
Otherwise maybe @Pl45m4 can state what is wanted here?
-
assuming:
MainWindow QMainWindow pvtloMain QVBoxLayout phzloTop QHBoxLayout cboTraineeToView QComboBox lblTtoV QLabel pbtnAdmin QPushButton pbtnBeginSession QPushButton pbtnEndSession QPushButton pbtnSearch QPushButton pgrdloContent QGridLayout
pvtloMain->setStretch(0, 0);
pvtloMain->setStretch(1, 1);that makes
phzloTop
take up as little space as possible andpgrdloContent
as much as possible -
@J-Hilk , I've removed both of those lines and the result is the same, they did nothing.
-
@JonB The QGridLayout is added to the QVBoxLayout in the designer, I cannot set the layoutRowStretch property, trying to set it to 1, it goes right back to 0 after I press enter.
-
@SPlatten
My last attempt, because I'm going out, and someone who knows designer better than me can doubtless say.The stretch needs to be set on the layout items added to the enclosing vboxlayout. That (the vboxlayout) has stretch factors doesn't it, or not? Temporarily put a stretch of 1 for its first first item, the hbox, and a stretch of 100 for its second item, the gridlayout? That's probably not fully right but does it do what you want? Else I don't know which way to do it.
-
@SPlatten than they layouts or widgets are otherwise constraint
did you set max height of the Gridlayout ? or the sizepolicy to fixed ?
because a default arrangement works as intended:
-
@J-Hilk
Thank you for rescuing me here! I leave you to deal further with the question ;-) -
@JonB, the QVboxLayout has the property layoutStretch with I've changed from 0,0 to 1,100.
Thats the puzzle solved! It works perfectly, thank you for your help and support.