PDA

View Full Version : QHeaderview resize mode issue



vaibhav
28th September 2011, 16:10
I want the contents of my tablewidget to occupy available space .

So i used tableWidget->horizontalHeader()->setResizeMode(QHeader::Stretch);

Above code successfully uses the available space but it evenly resize Horizontal width for all the horizontal columns of header.
As a result widgets e.g LineEdit in my table widget which has minimum-width greater than the Horizontal-width of column of header overlaps with next column.


It could be solved by resizing the specific column in the header to ResizeToContents as below

tableWidget->horizontalHeader()->setResizeMode(1,QHeader::ResizeToContents );

But how can i programatically determine which column i should ResizeToContents .?

Or is there better way to address the issue .



Any help would be Appreciated .


Thanks.