tags:

views:

22

answers:

1

I have a widget which I'm putting in a QVBoxLayout. This widget's layout is a QVBoxLayout which includes a QTableWidget. When I display this everything is fine but the QTableWidget only shows a few rows. How can I set the height of the table to a decent value (like 20 rows) while still allowing the table to resize?

I've tried calling table.setMinimumHeight(200) but then the table can NEVER be smaller than 200. I've also tried setting the container widget height using setMinimumHeight but this has the same problem.

+1  A: 

Check the sizePolicy for the QTableWidget. This will have horizontal and vertical size policies which, if I understand you correctly, should be set to "expanding" or "minimum expanding". There are a number of options and combinations for these and sometimes it can be tricky getting the right combination for all the widgets in your layout to get what you are looking for.

The size policies will work in combination with your min/max height/width settings and those of the other widgets in the layout.

Arnold Spence