PDA

View Full Version : how to set qtableview‘s row’height



calmspeaker
5th June 2009, 11:12
I use setRowHeight() to change the row's height, but when the model's data changed, the row's height get back to the default value.

Please give me some clue! thank you in advance!

spirit
5th June 2009, 11:25
try to use QHeaderView::resizeSection for setting a row height.
an access to a header you can get using QTableView::verticalHeader.

calmspeaker
6th June 2009, 06:50
try to use QHeaderView::resizeSection for setting a row height.
an access to a header you can get using QTableView::verticalHeader.

I look into the source code of Qt. In the function setRowHeight() actually call the function QHeaderView::resizeSection.
I changed the height using the funciton QHeaderView::setDefaultSectionSize(int ).
:)
I think if you donnot want to changed the section size dynamically, this is a efficient way!