Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 941 Bytes

README.md

File metadata and controls

32 lines (22 loc) · 941 Bytes

QHBoxLayout

1、水平布局

查看 BaseHorizontalLayout.ui

BaseHorizontalLayout

2、边距和间隔

查看 HorizontalLayoutMargin.ui

  1. 通过setContentsMargins(-1, -1, 20, -1)设置左上右下的边距,-1表示默认值
  2. 通过setSpacing设置控件之间的间隔

HorizontalLayoutMargin

3、比例分配

查看 HorizontalLayoutStretch.ui

通过setStretch设置各个部分的占比 分别为:1/6 2/6 3/6

self.horizontalLayout.setStretch(0, 1)
self.horizontalLayout.setStretch(1, 2)
self.horizontalLayout.setStretch(2, 3)

HorizontalLayoutStretch