问题
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