I try to create the QTableWidget with the number of columns and rows specified at the moment of creation and then populate its cells with widgets using setCellWidget().

It works except for one moment: the widget is resized to fit the cell. I tried setting the widget's minimal size, but it resulted in a really bad outcome: the cell size remained the same, and widgets started overlapping, creating a total mess in the table.

Is there a way to make Qt set the height of rows and width of columns so that the biggest widget fits well?