I use PySide6 together with the pyside6-designer. Now I have a GridLayout with two columns. How can I insert a widget into a field of the left column, so that it spans two columns?
When I compile the resulting ui file, I can set the columnSpan parameter of the addItem() method to 2 in the resulting Python code. Then it also works. But how can I achieve this in the Designer?
Here is the statement from the documentation:
addItem(item, row, column[, rowSpan=1[, columnSpan=1[, alignment=Qt.Alignment()]]])
Hi @WolleKette welcome to the forum!
This is easier than it appears: to get a widget to span multiple columns of a grid layout, just place the widget in the grid and then grab the resize handle on the side of the widget and expand it to to the width of two columns. If you release the handle as you resize it slightly in one direction you’ll see it snap to fill the column.
Short video below showing this in action.
Oh how stupid. It’s so simple, yet too straightforward to think of on one’s own.
Many thanks for your support!