QT之layout参数设置

  • Post author:
  • Post category:其他


一、参数含义

1、layoutLeftMargin: layout内的布局距离边框左端的距离。

2、layoutTopMargin: layout内的布局距离边框顶端的距离。

3、layoutRightMargin: layout内的布局距离边框右端的距离。

4、layoutBottomMargin: layout内的布局距离边框底端的距离。

5、layoutHorizontalSpacing: layout内的水平方向内的对象(包括控件和低一级布局)的水平间隙。

6、layoutVerticalSpacing:layout内的垂直方向内的对象(包括控件和低一级布局)的垂直间隙。

7、layoutRowStretch: layout内的水平方向内的对象(包括控件和低一级布局)的水平尺寸比例。(例如1,2,表示水平的两个对象的宽度比例为1:2,不过这也会受到sizePolicy影响)

8、layoutColumnStretch: layout内的垂直方向内的对象(包括控件和低一级布局)的垂直尺寸比例。

二、参数设置

以栅格布局(Grid Layout)为例:


设置各控件的间隙

:layoutHorizontalSpacing、layoutVerticalSpacing


设置控件与布局的边界

: layoutLeftMargin: layout

layoutTopMargin

layoutRightMargin

layoutBottomMargin


设置布局内各控件大小比例

:layoutRowStretch、layoutColumnStretch



版权声明:本文为baidu_39231810原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。