For Qt versions < 5
QHeaderView *verticalHeader = myTableView->verticalHeader();
verticalHeader->setResizeMode(QHeaderView::Fixed);
verticalHeader->setDefaultSectionSize(24);
For Qt versions >= 5 use
QHeaderView *verticalHeader = myTableView->verticalHeader();
verticalHeader->setSectionResizeMode(QHeaderView::Fixed);
verticalHeader->setDefaultSectionSize(24);
If that function doesn't apply to vertical headers, you likely will have to call setRowHeight()
every time you add a new row.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…