I seem to have it:
 
model.setHeaderData(index, QtCore.Qt.Horizontal, QtCore.QSize(minimum_width, 
20), QtCore.Qt.SizeHintRole)
 
At least partly, not sure how to inherit the original height hint instead of 
using a fixed 20. If I leave it 0 or -1 then nothing is visible from the 
header...
 
 
B.

> From: sbre...@hotmail.com
> To: pyqt@riverbankcomputing.com
> Date: Thu, 15 Mar 2012 17:06:38 +0000
> Subject: Re: [PyQt] Minimum column width for 'QTableView'
> 
> 
> Actually, what I am looking for is a function like:
> 
> model.horizontalHeader().setMinimumSectionSize(column_index, xxx)
> 
> i.e. minimum section size _per_ column but not per table.
> 
> Any idea?
> 
> > From: sbre...@hotmail.com
> > To: pyqt@riverbankcomputing.com
> > Date: Thu, 15 Mar 2012 15:11:25 +0000
> > Subject: [PyQt] Minimum column width for 'QTableView'
> > 
> > 
> > Hello
> > 
> > wonder if there is an easy way to tell 'QTableView' what the minimum column 
> > width should be.
> > 
> > 'resizeColumnsToContents' does not really do what we want. Often we start 
> > with an empty table and in this case 'resizeColumnsToContents' would make 
> > the columns too narrow. The same applies when we have a filter set on the 
> > table, and only a few rows with relatively short values are listed, we 
> > still want to have enough space when a new row is added.
> > 
> > Any help would be appreciated.
> > 
> > 
> > Cheers
> > B. 
> > _______________________________________________
> > PyQt mailing list PyQt@riverbankcomputing.com
> > http://www.riverbankcomputing.com/mailman/listinfo/pyqt 
> _______________________________________________
> PyQt mailing list PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt                       
>                   
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to