[PyQt] Detecting if a column has been resized by the user; auto-stretching columns.

David Boddie david at boddie.org.uk
Thu Dec 4 00:07:56 GMT 2008


On Wed Dec 3 17:10:00 GMT 2008, Anonymous wrote:

> Thanks for the response, but i saw that in the documentation before asking,
> and it's not what i'm looking for. The columns for my purpose do not need
> to be fully stretched out, i just need the last column in the view to
> auto-stretch if there is space for it to take up.

Then there is a solution. It's quite well hidden:

  tableWidget.horizontalHeader().setStretchLastSection(True)
      
It's the header that handles the width of each column, which is obvious
if you think about tables in a certain way, but it seems to catch a lot
of people out.

David


More information about the PyQt mailing list