PDA

View Full Version : Resizing QTableView



ghutchis
12th May 2008, 19:53
In my code, I've got some QTableView widgets which I pop up as new windows. Naturally, I want to allow the user to resize these.

What happens with small tables is that you can resize the window very large -- and the table won't change column width.

Forgive my ignorance -- I'm a bit of a Qt newbie. Is there an easy way to set the maximum width of the window to the maximum width of the QTableView? In other words, can I set the resizing to stop when the maximum width and/or height is reached?

Thanks in advance!

mitro
12th May 2008, 20:09
Try setMaximumWidth() and setMaximumHeight() functions.

jpn
12th May 2008, 20:10
Requested functions can be found from QWidget API but I'd recommend looking at QHeaderView API instead. Just make certain columns stretch to fulfill the empty space.

ghutchis
12th May 2008, 21:36
Thanks! The QHeaderView was exactly what I wanted to see. The setMaximumWidth() and setMaximumHeight() are helpful, but don't allow stretching columns.