I hope the check box is aligned from the top. What should I do?
-
I use pyqt5. I make verticalLayout.addWidget(checkBox)
It's not the result I expected. It's concentrated in the center, so I hope it comes out in order from the top
change self.fileLayout.addWidget(cb) -> self.fileLayout.addWidget(cb, alignment=Qt.AlignTop)
result... gap between the check boxes is too wide. What should I do? very sad..
-
I use pyqt5. I make verticalLayout.addWidget(checkBox)
It's not the result I expected. It's concentrated in the center, so I hope it comes out in order from the top
change self.fileLayout.addWidget(cb) -> self.fileLayout.addWidget(cb, alignment=Qt.AlignTop)
result... gap between the check boxes is too wide. What should I do? very sad..
@Radell
Well, since you already discovered thatself.fileLayout.addWidget(cb, alignment=Qt.AlignTop)
moved the first checkbox to the top, why wouldn't you do that to the second checkbox too?IIRC, the way to make all widgets move to the top is by QBoxLayout::addStretch(int stretch = 0) to add a stretch after your checkboxes. That then "stretches" as much as possible, filling the whole of the bottom area.
-
@Radell
Well, since you already discovered thatself.fileLayout.addWidget(cb, alignment=Qt.AlignTop)
moved the first checkbox to the top, why wouldn't you do that to the second checkbox too?IIRC, the way to make all widgets move to the top is by QBoxLayout::addStretch(int stretch = 0) to add a stretch after your checkboxes. That then "stretches" as much as possible, filling the whole of the bottom area.
@JonB said in I hope the check box is aligned from the top. What should I do?:
IIRC, the way to make all widgets move to the top is by QBoxLayout::addStretch(int stretch = 0) to add a stretch after your checkboxes. That then "stretches" as much as possible, filling the whole of the bottom area.
Did you do this? (This means one stretch after the last checkbox.)
-
@JonB said in I hope the check box is aligned from the top. What should I do?:
IIRC, the way to make all widgets move to the top is by QBoxLayout::addStretch(int stretch = 0) to add a stretch after your checkboxes. That then "stretches" as much as possible, filling the whole of the bottom area.
Did you do this? (This means one stretch after the last checkbox.)