Qt widget (with layout) space. What is it? How to remove?

帅比萌擦擦* 提交于 2019-11-28 13:49:32

This is contentsMargin

To remove it:

t->setContentsMargins(0,0,0,0);

The space you referring to is a content margin. The docu here describes how the widgets are drawn. To get rid of that extra space you have to call:

widget->setContentsMargins(0, 0, 0, 0);

I believe the end result should look like this:

The method I recall to control spacing is to add dedicated QSpacerItem items between the widgets.

But I'm first trying to figure out what w is doing. Why not call g1a_l->addLayout(t); directly?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!