Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pyside - QGridLayout addStretch option?

I have a layout that I need the widgets pushed upwards. I know I can do this

layout = QtWidgets.QVBoxLayout()
layout.addWidget(test_widget)
layout.addStretch()

and the addStretch will push all widgets to the top. However the layout that I am using is a QGridLayout and .addSretch() does not work with the grid layout. How would I fill in all the empty space at the bottom of my window and push all my widgets to the top with a grid layout?

like image 863
ghost654 Avatar asked Sep 20 '25 05:09

ghost654


1 Answers

nevermind, I found the answer. I had to to do this

layout.setRowStretch(row_number, 1)
like image 103
ghost654 Avatar answered Sep 23 '25 06:09

ghost654