Add a spacer line between layouts PyQt

社会主义新天地 提交于 2021-01-28 22:03:16

问题


I would like to add a spacer line between two layouts:

Separador = QFrame()
Separador.Shape(QFrame.HLine)
Separador.setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Expanding)
Separador.setLineWidth(3)
HPOUT1_layout = QVBoxLayout()
HPOUT1_layout.addLayout(HPOUT1L_layout)
HPOUT1_layout.addWidget(Separador)
HPOUT1_layout.addLayout(HPOUT1R_layout)

However, this code only separate the layouts a little, but there is no line visible between them. Is there another way, What I'm doing wrong?


回答1:


You are not setting the shape of the frame correctly.

Instead of

Separador.Shape(QFrame.HLine)

use

Separador.setFrameShape(QFrame.HLine)


来源:https://stackoverflow.com/questions/30974149/add-a-spacer-line-between-layouts-pyqt

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