How do you change the default row size in a QTableView so it is smaller? I can call resizeRowsToContents()
, but then subsequent inserts still add new rows at the end which are the default size.
I am guessing it might have something to do with style sheets but I'm not familiar enough with what things impact the visual changes.
I am using PySide in Python, but I think this is a general Qt question.
example view:
default table appearance
what the table looks like after resizeRowsToContents()
:
now if I add a new blank row at the end:
Darn, it uses the default row height, with all that extra space.
tableView.verticalHeader().setResizeMode(QHeaderView.ResizeToContents)
seems to works nicely, but it's dynamic and slows down my application when I'm doing lots of realtime updates. I really just want to get the standard row size. :-( – Rivatable.fontMetrics().height() + 6
). – LanilaniardsetSectionResizeMode
, notsetResizeMode
. – Alicyclic