I have a QTableView and all is ready, but I can't setup the rowHeight property. Who can help me? thanks in advance...
Printable View
I have a QTableView and all is ready, but I can't setup the rowHeight property. Who can help me? thanks in advance...
How exactly do you use setRowHeight?
this should do what you want:
Code:
m_tableView->verticalHeader()->setDefaultSectionSize(20); //setHeight m_tableView->setModel(myModel);
As a side note (and like darksaga's example shows), QHeaderView::setDefaultSectionSize() must be called before attaching a model to the table view.
Had also probs with the rowheight when i used QTableView first.
My experience is that it depends on the order how you setup your model & tabel and where you call
Code:
m_tableView->verticalHeader()->setDefaultSectionSize(20);
Try to call setDefaultSectionSize @ a different place.
afaik, it will always work with the order I posted above.
Be careful:
If you have a table with many rows & columns resizeRowsToContents && resizeColumnsToContents could slow down your app drastically.
in the project I'm currently developing I had to ban these due to servere slowdowns...