[Qt-interest] Qt 4.6 change in resizeColumnsToContents() and resizeColumnToContent(int) behavior?

Linos info at linos.es
Thu Aug 5 18:25:56 CEST 2010


Hello,
	i have a QTableView with a QSortFilterProxyModel using a QSqlQueryModel as 
source, in Qt 4.5 i execute after the query has populated the data of the table 
resizeColumnsToContents() or resizeColumnToContent(int) and it get adjusted to 
the column contents but in Qt 4.6 if i have not overload the sizeHint method in 
the delegate and i use the default QStyledItemDelegate.sizeHint method the col 
get not resized correctly, you can see an example here:

http://img819.imageshack.us/img819/804/examplet.png

I have printed to console the output of the sizehint of the delegate for the 
first visible col "SERIE" and row 0 and i get QSize(31, 15) in QT 4.6 and 
QSize(31, 16) in QT 4.5 but when i print the size of the section from the 
horizontal QHeaderView after the resize of the col i get 73 in Qt 4.6 and 46 in 
Qt 4.5, this col it is ever of three char in all the rows of the model, the same 
three chars, so i don't understand why exists this difference, can anyone help 
me with this? Thanks.

Regards,
Miguel Angel.





More information about the Qt-interest-old mailing list