Qt5 too big space between widgets in one vertical layout.
-
@GUYUEZUNZHE
Are these two the only widgets on the vertical layout?I may (well) be wrong, but if you put a stretch after layer #2, and possibly before layer #1, does that force them closer togther?
-
Thank you for your reply! there are many widgets, I add a new widget by clicking the "Add" button. I tried putting a stretch before layer #1, it doesn't force them closer together. I will try put stretch after layer #2 and report it later.
-
@GUYUEZUNZHE
Certianly if you have stretches both above & below the two layers" will be pushed together as close as possible. If there is still a gap, then whatever your "layers" are, maybe they have, say, vertical margins or similar keeping them apart? Also make sure your vertical layout has0
value for its QBoxLayout::setSpacing(). -
@JonB said in Qt5 too big space between widgets in one vertical layout.:
If there is still a gap, then whatever your "layers" are, maybe they have, say, vertical margins or similar keeping them apart?
unfortunately! There is still a gap. there are no margins or similarities keeping them apart. here is the layer I edit.
-
@GUYUEZUNZHE
Well I can see margins or similar all around the Layer #1 you show. But perhaps you mean there is a gap below the bottom of this Layer #1 and the top of the Layer #2, since in your earlier picture you show that in a different colour? Perhaps you should show a screenshot of what you actually see when you run the application so we can see what you are really talking about? -
@GUYUEZUNZHE
Are you sure you acted on thesetSpacing()
I mentioned? What doesqDebug() << verticalLayout->spacing()
report? -
ui->verticalLayout_6->spacing() is 6
-
@GUYUEZUNZHE
Try to add a VerticalSpacer at the end in verticalLayout.