PYQT QGridlayout布局设置每列每行大小相同
2021-06-28 本文已影响0人
aq_wzj
def gridLayoutSet(self, layout):
# 设置每行每列比例一致
# 需设置每行每列最小宽度或高度,size需小于self.width() / layout.rowCount()
rowSize = 100
colSize = 100
for row in range(layout.rowCount()):
layout.setRowStretch(row, 1)
layout.setRowMinimumHeight(row, rowSize)
for col in range(layout.columnCount()):
layout.setColumnStretch(col, 1)
layout.setColumnMinimumWidth(col, colSize)